aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/bsc/osmo_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/osmo_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/osmo_bsc_vty.c')
-rw-r--r--openbsc/src/bsc/osmo_bsc_vty.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/openbsc/src/bsc/osmo_bsc_vty.c b/openbsc/src/bsc/osmo_bsc_vty.c
index ac366abb9..d5c018b7a 100644
--- a/openbsc/src/bsc/osmo_bsc_vty.c
+++ b/openbsc/src/bsc/osmo_bsc_vty.c
@@ -72,10 +72,7 @@ DEFUN(cfg_net_msc_token,
{
struct osmo_msc_data *data = osmo_msc_data(vty);
- if (data->bsc_token)
- talloc_free(data->bsc_token);
- data->bsc_token = talloc_strdup(data, argv[0]);
-
+ bsc_replace_string(data, &data->bsc_token, argv[0]);
return CMD_SUCCESS;
}
@@ -84,10 +81,8 @@ DEFUN(cfg_net_msc_ip,
"ip A.B.C.D", "Set the MSC/MUX IP address.")
{
struct osmo_msc_data *data = osmo_msc_data(vty);
- if (data->msc_ip)
- talloc_free(data->msc_ip);
- data->msc_ip = talloc_strdup(data, argv[0]);
+ bsc_replace_string(data, &data->msc_ip, argv[0]);
return CMD_SUCCESS;
}
@@ -142,9 +137,7 @@ DEFUN(cfg_net_msc_grace_ussd,
if (!txt)
return CMD_WARNING;
- if (data->ussd_grace_txt)
- talloc_free(data->ussd_grace_txt);
- data->ussd_grace_txt = talloc_strdup(data, txt);
+ bsc_replace_string(data, &data->ussd_grace_txt, txt);
talloc_free(txt);
return CMD_SUCCESS;
}