X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=misc.h;h=d5999cbedee2f1d723e0fe8755cc6d638791708e;hb=15386cbe927fc85ac2fed0bb47704645c4b67dad;hp=ae33e96e3fff7cb8dfd8d3d6cfc26a5bd5d2370c;hpb=3ad0c89feca43af8c4e8ddb913bc232ad4fb5521;p=PuTTY.git diff --git a/misc.h b/misc.h index ae33e96e..d5999cbe 100644 --- a/misc.h +++ b/misc.h @@ -187,4 +187,9 @@ void debug_memdump(const void *buf, int len, int L); (cp)[0] = (unsigned char)((value) >> 8), \ (cp)[1] = (unsigned char)(value) ) +/* Replace NULL with the empty string, permitting an idiom in which we + * get a string (pointer,length) pair that might be NULL,0 and can + * then safely say things like printf("%.*s", length, NULLTOEMPTY(ptr)) */ +#define NULLTOEMPTY(s) ((s)?(s):"") + #endif