4 Oct
2013
4 Oct
'13
8:58 a.m.
Hi, Two cents: On Fri, Oct 4, 2013 at 3:42 AM, Alexander Chemeris <alexander.chemeris@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