diff options
author | Harald Welte <laforge@gnumonks.org> | 2017-08-12 13:43:54 +0200 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2017-08-14 12:04:52 +0000 |
commit | 183070bcede412e38268c7f298262710b1351f6e (patch) | |
tree | e799a13910a196f1f92f94017f14ec12b3781ce0 /openbsc/src/gprs/gprs_utils.c | |
parent | 53552a303e8089d288c0caadb2b462a898589a01 (diff) |
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
Diffstat (limited to 'openbsc/src/gprs/gprs_utils.c')
-rw-r--r-- | openbsc/src/gprs/gprs_utils.c | 28 |
1 files changed, 0 insertions, 28 deletions
diff --git a/openbsc/src/gprs/gprs_utils.c b/openbsc/src/gprs/gprs_utils.c index 64ed9788d..91a09d2db 100644 --- a/openbsc/src/gprs/gprs_utils.c +++ b/openbsc/src/gprs/gprs_utils.c @@ -114,34 +114,6 @@ int gprs_msgb_resize_area(struct msgb *msg, uint8_t *area, return 0; } -/* TODO: Move these conversion functions to a utils file. */ -/* TODO: consolidate with gprs_apn2str(). */ -/** memmove apn_enc to out_str, replacing the length octets in apn_enc with '.' - * (omitting the first one) and terminating with a '\0'. - * out_str needs to have rest_chars amount of bytes or 1 whatever is bigger. - */ -char * gprs_apn_to_str(char *out_str, const uint8_t *apn_enc, size_t rest_chars) -{ - char *str = out_str; - - while (rest_chars > 0 && apn_enc[0]) { - size_t label_size = apn_enc[0]; - if (label_size + 1 > rest_chars) - return NULL; - - memmove(str, apn_enc + 1, label_size); - str += label_size; - rest_chars -= label_size + 1; - apn_enc += label_size + 1; - - if (rest_chars) - *(str++) = '.'; - } - str[0] = '\0'; - - return out_str; -} - int gprs_str_to_apn(uint8_t *apn_enc, size_t max_len, const char *str) { uint8_t *last_len_field; |