Re: [PATCH] Use NULL in vararg
On Mon, 8 Nov 2004 17:04:58 +0100, Ralf Wildenhues said:
> snprintf (fmt, sizeof(fmt), "%%%ss", prefix);
> - snprintf (buf, buflen, fmt, Context ? Context->pattern : 0);
> + snprintf (buf, buflen, fmt, Context ? Context->pattern : NULL);
Assuming a prefix of "%s", NULL is not a good idea because %s is not
guaranteed to print something like "(null)" as glibc does. Some libcs
will simply segv here. The proper way (if semantically okay) is to
use
snprintf (buf, buflen, fmt, Context ? Context->pattern : "(null)");
Salam-Shalom,
Werner