From 87802150d5ea959c126bffc48ab16b130b0f20a2 Mon Sep 17 00:00:00 2001 From: Eric House Date: Mon, 6 Apr 2020 16:34:02 -0700 Subject: [PATCH] fix logging macro to allow a single argument --- xwords4/common/comms.c | 2 +- xwords4/common/comtypes.h | 2 +- xwords4/common/engine.c | 2 +- xwords4/common/server.c | 8 ++++---- xwords4/common/smsproto.c | 2 +- xwords4/linux/cursesmain.c | 2 +- xwords4/linux/linuxmain.c | 2 +- xwords4/linux/relaycon.c | 2 +- xwords4/linux/xptypes.h | 4 ++-- 9 files changed, 13 insertions(+), 13 deletions(-) diff --git a/xwords4/common/comms.c b/xwords4/common/comms.c index 464d09f3c..47d492a07 100644 --- a/xwords4/common/comms.c +++ b/xwords4/common/comms.c @@ -964,7 +964,7 @@ comms_writeToStream( CommsCtxt* comms, XWStreamCtxt* stream, static void resetBackoff( CommsCtxt* comms ) { - XP_LOGFF( "%s", "resetting backoff" ); + XP_LOGFF( "resetting backoff" ); comms->resendBackoff = 0; comms->nextResend = 0; } diff --git a/xwords4/common/comtypes.h b/xwords4/common/comtypes.h index 8fe6857aa..7af0ee602 100644 --- a/xwords4/common/comtypes.h +++ b/xwords4/common/comtypes.h @@ -309,7 +309,7 @@ typedef struct _PlayerDicts { #endif -#define LOG_FUNC() XP_LOGFF( "%s", "IN" ) +#define LOG_FUNC() XP_LOGFF( "IN" ) #define LOG_RETURNF(fmt, ...) XP_LOGFF( "OUT: => " fmt, __VA_ARGS__ ) #define LOG_RETURN_VOID() LOG_RETURNF("%s","void") #define XP_LOGLOC() XP_LOGF( "%s(), line %d", __func__, __LINE__ ) diff --git a/xwords4/common/engine.c b/xwords4/common/engine.c index 1fcbe0372..8ba23d751 100644 --- a/xwords4/common/engine.c +++ b/xwords4/common/engine.c @@ -559,7 +559,7 @@ engine_findMove( EngineCtxt* engine, const ModelCtxt* model, engine_reset( engine ); if ( !isRetry ) { isRetry = XP_TRUE; - XP_LOGFF( "%s", "no moves found so retrying" ); + XP_LOGFF( "no moves found so retrying" ); goto retry; } } diff --git a/xwords4/common/server.c b/xwords4/common/server.c index 3ab9cbddc..f1c0c4ed1 100644 --- a/xwords4/common/server.c +++ b/xwords4/common/server.c @@ -2530,7 +2530,7 @@ nextTurn( ServerCtxt* server, XP_S16 nxtTurn ) nxtTurn = model_getNextTurn( server->vol.model ); } } else { - XP_LOGFF( "%s", "turn == -1 so dropping" ); + XP_LOGFF( "turn == -1 so dropping" ); } } else { /* We're doing an undo, and so won't bother figuring out who the @@ -2552,7 +2552,7 @@ nextTurn( ServerCtxt* server, XP_S16 nxtTurn ) SETSTATE( server, XWSTATE_NEEDSEND_ENDGAME ); /* this is it */ moreToDo = XP_TRUE; } else if ( currentTurn >= 0 ) { - XP_LOGFF( "%s", "Doing nothing; waiting for server to end game" ); + XP_LOGFF( "Doing nothing; waiting for server to end game" ); setTurn( server, -1 ); /* I'm the client. Do ++nothing++. */ } @@ -2930,7 +2930,7 @@ reflectMove( ServerCtxt* server, XWStreamCtxt* stream ) XP_LOGFF( "BAD: currentTurn %d < 0", server->nv.currentTurn ); } else if ( ! readMoveInfo( server, stream, &whoMoved, &isTrade, &newTiles, &tradedTiles, &isLegal, &badStack ) ) { /* modifies model */ - XP_LOGFF( "%s", "BAD: readMoveInfo() failed" ); + XP_LOGFF( "BAD: readMoveInfo() failed" ); } else { moveOk = XP_TRUE; } @@ -4072,7 +4072,7 @@ server_receiveMessage( ServerCtxt* server, XWStreamCtxt* incoming ) XP_LOGF( "%s: somebody's registering!!!", __func__ ); accepted = handleRegistrationMsg( server, incoming ); } else { - XP_LOGFF( "%s", "WTF: I'm not a server!!" ); + XP_LOGFF( "WTF: I'm not a server!!" ); } break; case XWPROTO_CLIENT_SETUP: diff --git a/xwords4/common/smsproto.c b/xwords4/common/smsproto.c index 85f81c8d1..e1aefb5e7 100644 --- a/xwords4/common/smsproto.c +++ b/xwords4/common/smsproto.c @@ -648,7 +648,7 @@ savePartials( SMSProto* state ) XP_U16 newSize = stream_getSize( stream ); if ( state->lastStoredSize == 2 && newSize == 2 ) { - XP_LOGFF( "%s", "not storing empty again" ); + XP_LOGFF( "not storing empty again" ); } else { dutil_storeStream( state->dutil, KEY_PARTIALS, stream ); state->lastStoredSize = newSize; diff --git a/xwords4/linux/cursesmain.c b/xwords4/linux/cursesmain.c index c4f370072..4c7436f2d 100644 --- a/xwords4/linux/cursesmain.c +++ b/xwords4/linux/cursesmain.c @@ -1297,7 +1297,7 @@ cursesDevIDReceived( void* closure, const XP_UCHAR* devID, } (void)g_timeout_add_seconds( maxInterval, keepalive_timer, aGlobals ); } else { - XP_LOGFF( "%s", "bad relayid" ); + XP_LOGFF( "bad relayid" ); db_remove( pDb, KEY_RDEVID ); DevIDType typ; diff --git a/xwords4/linux/linuxmain.c b/xwords4/linux/linuxmain.c index b5cf28b75..b954f0cc1 100644 --- a/xwords4/linux/linuxmain.c +++ b/xwords4/linux/linuxmain.c @@ -771,7 +771,7 @@ secondTimerFired( gpointer data ) XP_U16 undoRatio = cGlobals->params->undoRatio; if ( 0 != undoRatio ) { if ( (XP_RANDOM() % 1000) < undoRatio ) { - XP_LOGFF( "%s", "calling server_handleUndo()" ); + XP_LOGFF( "calling server_handleUndo()" ); if ( server_handleUndo( game->server, 1 ) ) { board_draw( game->board ); } diff --git a/xwords4/linux/relaycon.c b/xwords4/linux/relaycon.c index 3bd2f20e9..82c7b7f6d 100644 --- a/xwords4/linux/relaycon.c +++ b/xwords4/linux/relaycon.c @@ -678,7 +678,7 @@ process( RelayConStorage* storage, XP_U8* buf, ssize_t nRead ) break; } case XWPDEV_GOTINVITE: { - XP_LOGFF( "%s", "got XWPDEV_GOTINVITE" ); + XP_LOGFF( "got XWPDEV_GOTINVITE" ); #ifdef DEBUG XP_U32 sender = #endif diff --git a/xwords4/linux/xptypes.h b/xwords4/linux/xptypes.h index 89a50d191..61a38c8be 100644 --- a/xwords4/linux/xptypes.h +++ b/xwords4/linux/xptypes.h @@ -78,7 +78,7 @@ extern void linux_debugf(const char*, ...) extern void linux_debugff(const char* func, const char* file, const char* fmt, ...) __attribute__ ((format (printf, 3, 4))); # define XP_LOGFF( FMT, ... ) \ - linux_debugff( __func__, __FILE__, FMT, __VA_ARGS__ ) + linux_debugff( __func__, __FILE__, FMT, ##__VA_ARGS__ ) #define XP_LOG(STR) \ linux_debugff( __func__, __FILE__, "%s", STR ) @@ -125,7 +125,7 @@ void linux_lowerstr( XP_UCHAR* str ); #define XP_ABS(a) ((a)>=0?(a):-(a)) #ifdef DEBUG -# define XP_ASSERT(B) do { if (!(B)) { XP_LOGFF( "%s", "firing assert"); } assert(B); } while (0) +# define XP_ASSERT(B) do { if (!(B)) { XP_LOGFF( "firing assert"); } assert(B); } while (0) void linux_backtrace( void ); # define XP_BACKTRACE linux_backtrace #else