[PATCH 6/6] Introduce a standard way for printing a subscriber's info.

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/OpenBSC@lists.osmocom.org/.

Alex Badea vamposdecampos at gmail.com
Fri Oct 4 06:58:20 UTC 2013


Hi,

Two cents:

On Fri, Oct 4, 2013 at 3:42 AM, Alexander Chemeris
<alexander.chemeris at gmail.com> wrote:
> +#define GSM_SUBS_FMT_STR "IMSI %s (id %llu, ext %s%s%s)"
> +#define GSM_SUBS_FMT_VAL(x) (x)->imsi, (x)->id, (x)->extension, \
> +    strlen((x)->name)?", name ":"", strlen((x)->name)?(x)->name:""

Checking for an empty string might be done by testing *s or s[0]
instead of strlen(s).
Also the second check for an empty string is superfluous, since it'll
print the same either way.

So one might write that as:

#define GSM_SUBS_FMT_VAL(x) (x)->imsi, (x)->id, (x)->extension, \
    (x)->name[0] ? ", name " : "", (x)->name

Cheers,
Alex




More information about the OpenBSC mailing list