aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/nat/bsc_nat_utils.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/nat/bsc_nat_utils.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/nat/bsc_nat_utils.c')
-rw-r--r--openbsc/src/nat/bsc_nat_utils.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/openbsc/src/nat/bsc_nat_utils.c b/openbsc/src/nat/bsc_nat_utils.c
index e11b48c31..89d7d4b22 100644
--- a/openbsc/src/nat/bsc_nat_utils.c
+++ b/openbsc/src/nat/bsc_nat_utils.c
@@ -28,6 +28,7 @@
#include <openbsc/gsm_data.h>
#include <openbsc/debug.h>
#include <openbsc/ipaccess.h>
+#include <openbsc/vty.h>
#include <osmocore/linuxlist.h>
#include <osmocore/talloc.h>
@@ -100,9 +101,7 @@ struct bsc_nat *bsc_nat_alloc(void)
void bsc_nat_set_msc_ip(struct bsc_nat *nat, const char *ip)
{
- if (nat->msc_ip)
- talloc_free(nat->msc_ip);
- nat->msc_ip = talloc_strdup(nat, ip);
+ bsc_replace_string(nat, &nat->msc_ip, ip);
}
struct bsc_connection *bsc_connection_alloc(struct bsc_nat *nat)