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.
diff --git a/openbsc/tests/bsc-nat/Makefile.am b/openbsc/tests/bsc-nat/Makefile.am
index f5af721..fc77557 100644
--- a/openbsc/tests/bsc-nat/Makefile.am
+++ b/openbsc/tests/bsc-nat/Makefile.am
@@ -6,10 +6,11 @@
 noinst_PROGRAMS = bsc_nat_test
 
 bsc_nat_test_SOURCES = bsc_nat_test.c \
+			$(top_srcdir)/src/common_vty.c \
 			$(top_srcdir)/src/nat/bsc_filter.c \
 			$(top_srcdir)/src/nat/bsc_sccp.c \
 			$(top_srcdir)/src/nat/bsc_nat_utils.c \
 			$(top_srcdir)/src/nat/bsc_mgcp_utils.c \
 			$(top_srcdir)/src/mgcp/mgcp_protocol.c \
 			$(top_srcdir)/src/mgcp/mgcp_network.c
-bsc_nat_test_LDADD = $(top_builddir)/src/libbsc.a $(LIBOSMOCORE_LIBS) -lrt $(LIBOSMOSCCP_LIBS)
+bsc_nat_test_LDADD = $(top_builddir)/src/libbsc.a $(LIBOSMOCORE_LIBS) -lrt $(LIBOSMOSCCP_LIBS) $(LIBOSMOVTY_LIBS)