diff options
author | John Levon <john.levon@sun.com> | 2009-01-15 17:54:20 +0000 |
---|---|---|
committer | John Levon <john.levon@sun.com> | 2009-01-15 17:54:20 +0000 |
commit | 4d713eabf56812a0119c844b8846e5007b2e4918 (patch) | |
tree | 5465e62571f1bb429c3481f74f3cf23c36bd8740 /src/internal.h | |
parent | c7095a4b4c21b0e919ec926ddf80b0bebdc8ec4e (diff) | |
download | libvirt-4d713eabf56812a0119c844b8846e5007b2e4918.tar.gz |
Avoid passing NULL to printf %s specifier
Diffstat (limited to 'src/internal.h')
-rw-r--r-- | src/internal.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/internal.h b/src/internal.h index f0c3d7dd13..696e5db1a3 100644 --- a/src/internal.h +++ b/src/internal.h @@ -7,6 +7,7 @@ #include <errno.h> #include <limits.h> +#include <verify.h> #ifdef HAVE_SYS_SYSLIMITS_H #include <sys/syslimits.h> @@ -115,6 +116,13 @@ #define ATTRIBUTE_RETURN_CHECK #endif /* __GNUC__ */ +/* + * Use this when passing possibly-NULL strings to printf-a-likes. + */ +#define NULLSTR(s) \ + ((void)verify_true(sizeof *(s) == sizeof (char)), \ + (s) ? (s) : "(null)") + /** * TODO: * |