diff options
author | Alan D. Brunelle <Alan.Brunelle@hp.com> | 2007-10-03 10:49:42 -0400 |
---|---|---|
committer | Alan D. Brunelle <adb@korik.(none)> | 2007-10-05 14:01:36 -0400 |
commit | 65a7043b1102901880fa6e3173ba2ab34e0cf113 (patch) | |
tree | 43195e8a9f82f8de6263bd2a595f8e2947f3e2c5 | |
parent | d47a3fec3f4bbcf6b0c6ef757a4eb449dd81d10a (diff) | |
download | blktrace-65a7043b1102901880fa6e3173ba2ab34e0cf113.tar.gz blktrace-65a7043b1102901880fa6e3173ba2ab34e0cf113.tar.bz2 |
Converted fatal from macro to inline
Hopefully this will fix a gcc-4.2.1 warning.
Signed-off-by: Alan D. Brunelle <adb@korik.(none)>
-rw-r--r-- | btreplay/btrecord.c | 23 | ||||
-rw-r--r-- | btreplay/btreplay.c | 23 |
2 files changed, 32 insertions, 14 deletions
diff --git a/btreplay/btrecord.c b/btreplay/btrecord.c index e02c153..09329f7 100644 --- a/btreplay/btrecord.c +++ b/btreplay/btrecord.c @@ -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 diff --git a/btreplay/btreplay.c b/btreplay/btreplay.c index 48181a4..89881cb 100644 --- a/btreplay/btreplay.c +++ b/btreplay/btreplay.c @@ -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) { |