On Thu, Jul 11, 2013 at 01:46:58PM +0800, Wenchao Xia wrote: > diff --git a/include/qemu-common.h b/include/qemu-common.h > index f439738..06c777f 100644 > --- a/include/qemu-common.h > +++ b/include/qemu-common.h > @@ -191,6 +191,9 @@ int64_t strtosz_suffix(const char *nptr, char **end, > const char default_suffix); > int64_t strtosz_suffix_unit(const char *nptr, char **end, > const char default_suffix, int64_t unit); > > +/* used to print char* safely */ > +#define STR_PRINT_CHAR(str) ((str) ? (str) : "null")
When I saw the name I thought it would filter out non-printable characters. Maybe STR_OR_NULL() is a better name? BTW the evil gcc shortcut is pretty quick to type: str ?: "null". Besides this I'm pretty happy with this version.