fix logging macro to allow a single argument

This commit is contained in:
Eric House 2020-04-06 16:34:02 -07:00
parent 4d63604a84
commit 674b9dbccf
9 changed files with 13 additions and 13 deletions

View file

@ -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;
}

View file

@ -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__ )

View file

@ -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;
}
}

View file

@ -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:

View file

@ -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;

View file

@ -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;

View file

@ -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 );
}

View file

@ -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

View file

@ -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