From 7e82b74c752a1581f7dfe0d6923293cecf062428 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Sat, 12 Aug 2017 13:43:54 +0200 Subject: Migrate from gprs_apn_to_str() to libosmocore osmo_apn_to_str() In 2015, Jacob moved/copied related functions to libosmocore, but for some reason didn't remove the copies here. Let's follow-up on that and remove duplicated code. The libosmocore commit introducing osmo_apn_to_str() was 8114294bf29ac6e44822c0ae43d4b0819f11b022 Change-Id: I7315ffcbed8a54cca2056f313bb7783ad82d0ee9 --- src/gprs/sgsn_vty.c | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) (limited to 'src/gprs/sgsn_vty.c') diff --git a/src/gprs/sgsn_vty.c b/src/gprs/sgsn_vty.c index cc8d6c399..cf44cc420 100644 --- a/src/gprs/sgsn_vty.c +++ b/src/gprs/sgsn_vty.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include @@ -116,7 +117,6 @@ DECLARE_TIMER(3397, "Wait for DEACT AA PDP CTX ACK timer (s)") #define GSM48_MAX_APN_LEN 102 /* 10.5.6.1 */ -/* TODO: consolidate with gprs_apn_to_str(). */ /** Copy apn to a static buffer, replacing the length octets in apn_enc with '.' * and terminating with a '\0'. Return the static buffer. * len: the length of the encoded APN (which has no terminating zero). @@ -124,23 +124,10 @@ DECLARE_TIMER(3397, "Wait for DEACT AA PDP CTX ACK timer (s)") static char *gprs_apn2str(uint8_t *apn, unsigned int len) { static char apnbuf[GSM48_MAX_APN_LEN+1]; - unsigned int i = 0; if (!apn) return ""; - - if (len > sizeof(apnbuf)-1) - len = sizeof(apnbuf)-1; - - memcpy(apnbuf, apn, len); - apnbuf[len] = '\0'; - - /* replace the domain name step sizes with dots */ - while (i < len) { - unsigned int step = apnbuf[i]; - apnbuf[i] = '.'; - i += step+1; - } + osmo_apn_to_str(apnbuf, apn, len); return apnbuf+1; } -- cgit v1.2.3