aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/common_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/common_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/common_vty.c')
-rw-r--r--openbsc/src/common_vty.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/openbsc/src/common_vty.c b/openbsc/src/common_vty.c
index 72d5163d8..541c18994 100644
--- a/openbsc/src/common_vty.c
+++ b/openbsc/src/common_vty.c
@@ -205,3 +205,11 @@ int bsc_vty_is_config_node(struct vty *vty, int node)
return 1;
}
}
+
+/* a talloc string replace routine */
+void bsc_replace_string(void *ctx, char **dst, const char *newstr)
+{
+ if (*dst)
+ talloc_free(*dst);
+ *dst = talloc_strdup(ctx, newstr);
+}