summaryrefslogtreecommitdiff
path: root/src/msg.h
diff options
context:
space:
mode:
authorJorge Arellano Cid <jcid@dillo.org>2009-05-29 16:23:03 -0400
committerJorge Arellano Cid <jcid@dillo.org>2009-05-29 16:23:03 -0400
commite16672e1ffcf3e52f1444c362c52183c9f9f201c (patch)
tree851bde9a9234362f03041b75db9b8e6aa4ac75c3 /src/msg.h
parentafc695fb7f3db2a69840a94a56ddfacd26a9cedd (diff)
Refactor of MSG macros
Diffstat (limited to 'src/msg.h')
-rw-r--r--src/msg.h23
1 files changed, 6 insertions, 17 deletions
diff --git a/src/msg.h b/src/msg.h
index 245ee803..c6ddcb48 100644
--- a/src/msg.h
+++ b/src/msg.h
@@ -11,28 +11,17 @@
#define _MSG_WARN(...)
#define _MSG_HTTP(...)
-
-#define MSG(...) \
+#define MSG_INNARDS(prefix, ...) \
D_STMT_START { \
if (prefs.show_msg){ \
- printf(__VA_ARGS__); \
+ printf(prefix __VA_ARGS__); \
fflush (stdout); \
} \
} D_STMT_END
-#define MSG_WARN(...) \
- D_STMT_START { \
- if (prefs.show_msg) \
- printf("** WARNING **: " __VA_ARGS__); \
- } D_STMT_END
-
-#define MSG_ERR(...) \
- D_STMT_START { \
- if (prefs.show_msg) \
- printf("** ERROR **: " __VA_ARGS__); \
- } D_STMT_END
-
-#define MSG_HTTP(...) \
- printf("HTTP warning: " __VA_ARGS__)
+#define MSG(...) MSG_INNARDS("", __VA_ARGS__)
+#define MSG_WARN(...) MSG_INNARDS("** WARNING **: ", __VA_ARGS__)
+#define MSG_ERR(...) MSG_INNARDS("** ERROR **: ", __VA_ARGS__)
+#define MSG_HTTP(...) MSG_INNARDS("HTTP warning: ", __VA_ARGS__)
#endif /* __MSG_H__ */