aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/bsc_vty.c
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-10-12 23:21:54 +0200
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-10-12 23:31:53 +0200
commit3e9a7f80bd6b1d62d3c3b175382ff15fa2f106c7 (patch)
treedaebaa0f94f1d7a22cfa0dbcccb9a4409f65a3c9 /openbsc/src/bsc_vty.c
parent9ecf678995145d7a49c440beb755627f03ff719c (diff)
misc: Replace the idiom for replacing a string with a function call
Remove a lot of code in favor of a new function that is freeing the old string and copying the new one. I should have gotten the context and the strings right.
Diffstat (limited to 'openbsc/src/bsc_vty.c')
-rw-r--r--openbsc/src/bsc_vty.c12
1 files changed, 2 insertions, 10 deletions
diff --git a/openbsc/src/bsc_vty.c b/openbsc/src/bsc_vty.c
index 97641f2b1..488ecc7f1 100644
--- a/openbsc/src/bsc_vty.c
+++ b/openbsc/src/bsc_vty.c
@@ -1062,11 +1062,7 @@ DEFUN(cfg_net_name_short,
{
struct gsm_network *gsmnet = gsmnet_from_vty(vty);
- if (gsmnet->name_short)
- talloc_free(gsmnet->name_short);
-
- gsmnet->name_short = talloc_strdup(gsmnet, argv[0]);
-
+ bsc_replace_string(gsmnet, &gsmnet->name_short, argv[0]);
return CMD_SUCCESS;
}
@@ -1077,11 +1073,7 @@ DEFUN(cfg_net_name_long,
{
struct gsm_network *gsmnet = gsmnet_from_vty(vty);
- if (gsmnet->name_long)
- talloc_free(gsmnet->name_long);
-
- gsmnet->name_long = talloc_strdup(gsmnet, argv[0]);
-
+ bsc_replace_string(gsmnet, &gsmnet->name_long, argv[0]);
return CMD_SUCCESS;
}