summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmit Shah <amit.shah@redhat.com>2009-10-29 20:41:24 +0530
committerAmit Shah <amit.shah@redhat.com>2009-10-29 20:42:42 +0530
commit7574267c457289aceccdadac5d7927199dcee24e (patch)
tree86c3a9c1f1194bc4639318d05d023d1f530730de
parent8d23286cd8293634d5aa578e8bfff46fee3c2977 (diff)
downloadtest-virtserial-7574267c457289aceccdadac5d7927199dcee24e.tar.gz
test-virtserial-7574267c457289aceccdadac5d7927199dcee24e.tar.xz
test-virtserial-7574267c457289aceccdadac5d7927199dcee24e.zip
auto-test: convert debug() into a func with varargs instead of it being a macro
This is a much better way of doing it Signed-off-by: Amit Shah <amit.shah@redhat.com>
-rw-r--r--auto-virtserial.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/auto-virtserial.c b/auto-virtserial.c
index 2ee9e57..537bdbb 100644
--- a/auto-virtserial.c
+++ b/auto-virtserial.c
@@ -29,6 +29,7 @@
#include <error.h>
#include <fcntl.h>
#include <poll.h>
+#include <stdarg.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
@@ -43,10 +44,14 @@
#define DEBUG 1
#ifdef DEBUG
-#define debug(fmt, ...) \
- do { \
- fprintf(stderr, fmt, __VA_ARGS__); \
- } while(0)
+void debug(const char *fmt, ...)
+{
+ va_list args;
+
+ va_start(args, fmt);
+ vfprintf(stderr, fmt, args);
+ va_end(args);
+}
#else
#define debug(fmt, ...) do { } while (0)
#endif