Przeglądaj źródła

sercmd: possibility to enable EXTRA_DEBUG via compile time option

- should get rid of empty DBG() resulting in unused init variable
Daniel-Constantin Mierla 12 lat temu
rodzic
commit
af1c2af129
1 zmienionych plików z 16 dodań i 2 usunięć
  1. 16 2
      utils/sercmd/parse_listen_id.c

+ 16 - 2
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