[prev in list] [next in list] [prev in thread] [next in thread]
List: util-linux-ng
Subject: [PATCH 04/12] include/c.h: add macro to print definitions as string
From: Sami Kerola <kerolasa () iki ! fi>
Date: 2014-04-27 20:05:30
Message-ID: 1398629138-31718-5-git-send-email-kerolasa () iki ! fi
[Download RAW message or body]
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
include/c.h | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/include/c.h b/include/c.h
index a192fb1..6b8793a 100644
--- a/include/c.h
+++ b/include/c.h
@@ -307,4 +307,13 @@ static inline int xusleep(useconds_t usec)
# define SEEK_HOLE 4
#endif
+
+/*
+ * Macros to convert #define'itions to strings, for example
+ * #define XYXXY 42
+ * printf ("%s=%s\n", stringify(XYXXY), stringify_value(XYXXY));
+ */
+#define stringify_value(s) stringify(s)
+#define stringify(s) #s
+
#endif /* UTIL_LINUX_C_H */
--
1.9.2
--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic