Module: sip-router
Branch: master
Commit: af1c2af129edeb49c6f2c826ec2c675e72c2486d
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=af1c2af…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Tue Jun 4 22:17:52 2013 +0200
sercmd: possibility to enable EXTRA_DEBUG via compile time option
- should get rid of empty DBG() resulting in unused init variable
---
utils/sercmd/parse_listen_id.c | 18 ++++++++++++++++--
1 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/utils/sercmd/parse_listen_id.c b/utils/sercmd/parse_listen_id.c
index 02c2f1e..5cef9cd 100644
--- a/utils/sercmd/parse_listen_id.c
+++ b/utils/sercmd/parse_listen_id.c
@@ -42,11 +42,25 @@
#define pkg_malloc malloc
#define pkg_free free
+#ifdef EXTRA_DEBUG
+static int _debug = 1;
+#else
+static int _debug = 0;
+#endif
+
#ifdef __SUNPRO_C
-#define DBG(...)
+#define DBG(...) \
+ do { \
+ if(_debug==1) \
+ fprintf(stderr, __VA_ARGS__); \
+ } while(0)
#define LOG(lev, ...) fprintf(stderr, __VA_ARGS__)
#else
-#define DBG(fmt, args...)
+#define DBG(fmt, args...) \
+ do { \
+ if(_debug==1) \
+ fprintf(stderr, fmt, ## args); \
+ } while(0)
#define LOG(lev, fmt, args...) fprintf(stderr, fmt, ## args)
#endif