From 88ce8a5c4401b662b0e5be66028f6f9610389e29 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Mon, 13 Oct 2008 22:45:05 +0000 Subject: [PATCH] more changes inspired by spry's `winport' code: for portability, use the standard __VA_ARGS__ macro for variadic macros instead of the CPP extensions. --- libtransmission/fdlimit.c | 2 +- libtransmission/peer-msgs.c | 2 +- libtransmission/rpc-server.c | 2 +- libtransmission/session.c | 2 +- libtransmission/tracker.c | 2 +- libtransmission/trevent.c | 2 +- libtransmission/utils.h | 24 +++++++++--------------- libtransmission/web.c | 2 +- 8 files changed, 16 insertions(+), 22 deletions(-) diff --git a/libtransmission/fdlimit.c b/libtransmission/fdlimit.c index cbfb06212..2ab3aec3b 100644 --- a/libtransmission/fdlimit.c +++ b/libtransmission/fdlimit.c @@ -59,7 +59,7 @@ #define TR_UINT_TO_PTR( i ) ( (void*)( (uint32_t)i ) ) #endif -#define dbgmsg( fmt... ) tr_deepLog( __FILE__, __LINE__, NULL, ## fmt ) +#define dbgmsg( ... ) tr_deepLog( __FILE__, __LINE__, NULL, __VA_ARGS__ ) /** *** diff --git a/libtransmission/peer-msgs.c b/libtransmission/peer-msgs.c index 6a8506a71..7c6ced456 100644 --- a/libtransmission/peer-msgs.c +++ b/libtransmission/peer-msgs.c @@ -345,7 +345,7 @@ myDebug( const char * file, } } -#define dbgmsg( msgs, fmt... ) myDebug( __FILE__, __LINE__, msgs, ## fmt ) +#define dbgmsg( msgs, ... ) myDebug( __FILE__, __LINE__, msgs, __VA_ARGS__ ) /** *** diff --git a/libtransmission/rpc-server.c b/libtransmission/rpc-server.c index 790a0b75e..cf1e0b95f 100644 --- a/libtransmission/rpc-server.c +++ b/libtransmission/rpc-server.c @@ -54,7 +54,7 @@ struct tr_rpc_server char * whitelist; }; -#define dbgmsg( fmt ... ) tr_deepLog( __FILE__, __LINE__, MY_NAME, ## fmt ) +#define dbgmsg( ... ) tr_deepLog( __FILE__, __LINE__, MY_NAME, __VA_ARGS__ ) /** *** diff --git a/libtransmission/session.c b/libtransmission/session.c index c2e155dcb..4dc5a7f2b 100644 --- a/libtransmission/session.c +++ b/libtransmission/session.c @@ -573,7 +573,7 @@ deadlineReached( const uint64_t deadline ) #define SHUTDOWN_MAX_SECONDS 30 -#define dbgmsg( fmt... ) tr_deepLog( __FILE__, __LINE__, NULL, ## fmt ) +#define dbgmsg( ... ) tr_deepLog( __FILE__, __LINE__, NULL, __VA_ARGS__ ) void tr_sessionClose( tr_handle * session ) diff --git a/libtransmission/tracker.c b/libtransmission/tracker.c index 52af47b5b..caace95bc 100644 --- a/libtransmission/tracker.c +++ b/libtransmission/tracker.c @@ -118,7 +118,7 @@ struct tr_tracker long lastAnnounceResponse; }; -#define dbgmsg( name, fmt... ) tr_deepLog( __FILE__, __LINE__, name, ## fmt ) +#define dbgmsg( name, ... ) tr_deepLog( __FILE__, __LINE__, name, __VA_ARGS__ ) /*** **** diff --git a/libtransmission/trevent.c b/libtransmission/trevent.c index f6625bc2a..b9748c79f 100644 --- a/libtransmission/trevent.c +++ b/libtransmission/trevent.c @@ -66,7 +66,7 @@ struct tr_run_data void * user_data; }; -#define dbgmsg( fmt... ) tr_deepLog( __FILE__, __LINE__, "event", ## fmt ) +#define dbgmsg( ... ) tr_deepLog( __FILE__, __LINE__, "event", __VA_ARGS__ ) static void readFromPipe( int fd, diff --git a/libtransmission/utils.h b/libtransmission/utils.h index f8c35295d..5331b49e6 100644 --- a/libtransmission/utils.h +++ b/libtransmission/utils.h @@ -105,23 +105,17 @@ const char* tr_strip_positional_args( const char* fmt ); #define _( a ) tr_strip_positional_args( a ) #endif -#define tr_nerr( n, a... ) tr_msg( __FILE__, __LINE__, TR_MSG_ERR, n, ## a ) -#define tr_ninf( n, a... ) tr_msg( __FILE__, __LINE__, TR_MSG_INF, n, ## a ) -#define tr_ndbg( n, a... ) tr_msg( __FILE__, __LINE__, TR_MSG_DBG, n, ## a ) +#define tr_nerr( n, ... ) tr_msg( __FILE__, __LINE__, TR_MSG_ERR, n, __VA_ARGS__ ) +#define tr_ninf( n, ... ) tr_msg( __FILE__, __LINE__, TR_MSG_INF, n, __VA_ARGS__ ) +#define tr_ndbg( n, ... ) tr_msg( __FILE__, __LINE__, TR_MSG_DBG, n, __VA_ARGS__ ) -#define tr_torerr( tor, a... ) tr_msg( __FILE__, __LINE__, TR_MSG_ERR,\ - tor->info.name, \ - ## a ) -#define tr_torinf( tor, a... ) tr_msg( __FILE__, __LINE__, TR_MSG_INF,\ - tor->info.name, \ - ## a ) -#define tr_tordbg( tor, a... ) tr_msg( __FILE__, __LINE__, TR_MSG_DBG,\ - tor->info.name, \ - ## a ) +#define tr_torerr( tor, ... ) tr_msg( __FILE__, __LINE__, TR_MSG_ERR, tor->info.name, __VA_ARGS__ ) +#define tr_torinf( tor, ... ) tr_msg( __FILE__, __LINE__, TR_MSG_INF, tor->info.name, __VA_ARGS__ ) +#define tr_tordbg( tor, ... ) tr_msg( __FILE__, __LINE__, TR_MSG_DBG, tor->info.name, __VA_ARGS__ ) -#define tr_err( a... ) tr_msg( __FILE__, __LINE__, TR_MSG_ERR, NULL, ## a ) -#define tr_inf( a... ) tr_msg( __FILE__, __LINE__, TR_MSG_INF, NULL, ## a ) -#define tr_dbg( a... ) tr_msg( __FILE__, __LINE__, TR_MSG_DBG, NULL, ## a ) +#define tr_err( ... ) tr_msg( __FILE__, __LINE__, TR_MSG_ERR, NULL, __VA_ARGS__ ) +#define tr_inf( ... ) tr_msg( __FILE__, __LINE__, TR_MSG_INF, NULL, __VA_ARGS__ ) +#define tr_dbg( ... ) tr_msg( __FILE__, __LINE__, TR_MSG_DBG, NULL, __VA_ARGS__ ) int tr_wildmat( const char * text, const char * pattern ); diff --git a/libtransmission/web.c b/libtransmission/web.c index 92b93b585..a6040b917 100644 --- a/libtransmission/web.c +++ b/libtransmission/web.c @@ -31,7 +31,7 @@ #define PULSE_MSEC 100 -#define dbgmsg( fmt... ) tr_deepLog( __FILE__, __LINE__, "web", ## fmt ) +#define dbgmsg( ... ) tr_deepLog( __FILE__, __LINE__, "web", __VA_ARGS__ ) struct tr_web {