This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
Harald Welte gerrit-no-reply at lists.osmocom.orgHarald Welte has submitted this change and it was merged. Change subject: vty: reduce code duplication ...................................................................... vty: reduce code duplication Use libosmocore's osmo_str2lower() instead of local equivalent. Change-Id: I7faced2eaf0f6f87f06081235eea9d4c3ba71a7e --- M src/common/vty.c 1 file changed, 6 insertions(+), 32 deletions(-) Approvals: Neels Hofmeyr: Looks good to me, but someone else must approve Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/common/vty.c b/src/common/vty.c index 646ac87..3f736c9 100644 --- a/src/common/vty.c +++ b/src/common/vty.c @@ -35,7 +35,7 @@ #include <osmocom/vty/misc.h> #include <osmocom/vty/ports.h> #include <osmocom/core/gsmtap.h> - +#include <osmocom/core/utils.h> #include <osmocom/trau/osmo_ortp.h> @@ -234,37 +234,11 @@ return CMD_SUCCESS; } -/* FIXME: move to libosmocore ? */ -static char buf_casecnvt[256]; -char *osmo_str_tolower(const char *in) -{ - int len, i; - - if (!in) - return NULL; - - len = strlen(in); - if (len > sizeof(buf_casecnvt)) - len = sizeof(buf_casecnvt); - - for (i = 0; i < len; i++) { - buf_casecnvt[i] = tolower(in[i]); - if (in[i] == '\0') - break; - } - if (i < sizeof(buf_casecnvt)) - buf_casecnvt[i] = '\0'; - - /* just to make sure we're always zero-terminated */ - buf_casecnvt[sizeof(buf_casecnvt)-1] = '\0'; - - return buf_casecnvt; -} - static void config_write_bts_single(struct vty *vty, struct gsm_bts *bts) { struct gsm_bts_role_bts *btsb = bts_role_bts(bts); struct gsm_bts_trx *trx; + char buf_casecnvt[256]; int i; vty_out(vty, "bts %u%s", bts->nr, VTY_NEWLINE); @@ -294,13 +268,13 @@ for (i = 0; i < 32; i++) { if (gsmtap_sapi_mask & (1 << i)) { - const char *name = get_value_string(gsmtap_sapi_names, i); - vty_out(vty, " gsmtap-sapi %s%s", osmo_str_tolower(name), VTY_NEWLINE); + osmo_str2lower(buf_casecnvt, get_value_string(gsmtap_sapi_names, i)); + vty_out(vty, " gsmtap-sapi %s%s", buf_casecnvt, VTY_NEWLINE); } } if (gsmtap_sapi_acch) { - const char *name = get_value_string(gsmtap_sapi_names, GSMTAP_CHANNEL_ACCH); - vty_out(vty, " gsmtap-sapi %s%s", osmo_str_tolower(name), VTY_NEWLINE); + osmo_str2lower(buf_casecnvt, get_value_string(gsmtap_sapi_names, GSMTAP_CHANNEL_ACCH)); + vty_out(vty, " gsmtap-sapi %s%s", buf_casecnvt, VTY_NEWLINE); } vty_out(vty, " min-qual-rach %.0f%s", btsb->min_qual_rach * 10.0f, VTY_NEWLINE); -- To view, visit https://gerrit.osmocom.org/2162 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I7faced2eaf0f6f87f06081235eea9d4c3ba71a7e Gerrit-PatchSet: 1 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Max <msuraev at sysmocom.de> Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>