Converted fatal from macro to inline
authorAlan D. Brunelle <Alan.Brunelle@hp.com>
Wed, 3 Oct 2007 14:49:42 +0000 (10:49 -0400)
committerAlan D. Brunelle <adb@korik.(none)>
Fri, 5 Oct 2007 18:01:36 +0000 (14:01 -0400)
Hopefully this will fix a gcc-4.2.1 warning.

Signed-off-by: Alan D. Brunelle <adb@korik.(none)>
btreplay/btrecord.c
btreplay/btreplay.c

index e02c153f63db94e33c34cabc61303c5c46ff4a54..09329f7a4fd549e91e6942f7b15df49b174ef895 100644 (file)
@@ -30,6 +30,7 @@ static char build_date[] = __DATE__ " at "__TIME__;
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <dirent.h>
+#include <stdarg.h>
 
 #if !defined(_GNU_SOURCE)
 #      define _GNU_SOURCE
@@ -181,13 +182,21 @@ static struct option l_opts[] = {
 
 #define ERR_ARGS                       1
 #define ERR_SYSCALL                    2
-#define fatal(errstring, exitval, arg...)                              \
-       do {                                                            \
-               if (errstring) perror(errstring);                       \
-               fprintf(stderr, ##arg);                                 \
-               exit(exitval);                                          \
-               /*NOTREACHED*/                                          \
-       } while (0)
+static inline void fatal(const char *errstring, const int exitval,
+                        const char *fmt, ...)
+{
+       va_list ap;
+
+       if (errstring)
+               perror(errstring);
+
+       va_start(ap, fmt);
+       vfprintf(stderr, fmt, ap);
+       va_end(ap);
+
+       exit(exitval);
+       /*NOTREACHED*/
+}
 
 /**
  * match - Return true if this trace is a proper QUEUE transaction
index 48181a44dcfdd5bb8cd4ff5c63f79f79b2f4ed34..89881cbd48b7baacf0f8ff34c8140839a0df516d 100644 (file)
@@ -37,6 +37,7 @@ static char build_date[] = __DATE__ " at "__TIME__;
 #include <sys/time.h>
 #include <sys/types.h>
 #include <dirent.h>
+#include <stdarg.h>
 
 #if !defined(_GNU_SOURCE)
 #      define _GNU_SOURCE
@@ -207,13 +208,21 @@ static char usage_str[];
  */
 #define ERR_ARGS                       1
 #define ERR_SYSCALL                    2
-#define fatal(errstring, exitval, arg...)                              \
-       do {                                                            \
-               if (errstring) perror(errstring);                       \
-               fprintf(stderr, ##arg);                                 \
-               exit(exitval);                                          \
-               /*NOTREACHED*/                                          \
-       } while (0)
+static inline void fatal(const char *errstring, const int exitval,
+                        const char *fmt, ...)
+{
+       va_list ap;
+
+       if (errstring)
+               perror(errstring);
+
+       va_start(ap, fmt);
+       vfprintf(stderr, fmt, ap);
+       va_end(ap);
+
+       exit(exitval);
+       /*NOTREACHED*/
+}
 
 static inline long long unsigned du64_to_sec(__u64 du64)
 {