[PATCH 2/4 v2] mtd-utils: new bareverbose() helper
Mike Frysinger
vapier at gentoo.org
Sat Sep 25 02:05:25 EDT 2010
Add a new helper that lets people do simple verbose output without any
implicit strings added around it. Good for progress bars and such.
Signed-off-by: Mike Frysinger <vapier at gentoo.org>
---
v2
- fix typo in changelog
include/common.h | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/include/common.h b/include/common.h
index e87b215..11b0cf6 100644
--- a/include/common.h
+++ b/include/common.h
@@ -38,10 +38,12 @@ extern "C" {
#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
/* Verbose messages */
-#define verbose(verbose, fmt, ...) do { \
+#define bareverbose(verbose, fmt, ...) do { \
if (verbose) \
- printf(PROGRAM_NAME ": " fmt "\n", ##__VA_ARGS__); \
+ printf(fmt, ##__VA_ARGS__); \
} while(0)
+#define verbose(verbose, fmt, ...) \
+ bareverbose(verbose, PROGRAM_NAME ": " fmt "\n", ##__VA_ARGS__)
/* Normal messages */
#define normsg(fmt, ...) do { \
--
1.7.2.3
More information about the linux-mtd
mailing list