δΊ 2013-7-18 19:07, Stefan Hajnoczi ει:
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?
I'll use STR_OR_NULL(), looks better.
BTW the evil gcc shortcut is pretty quick to type: str ?: "null".
Besides this I'm pretty happy with this version.
--
Best Regards
Wenchao Xia