add and use boolToStr

Just to make log messages a bit more helpful. Should be no behavior
change, and no change in code generated in release builds.
This commit is contained in:
Eric House 2017-01-22 14:15:29 -08:00
parent 4a93281a2d
commit b96d44393a
8 changed files with 19 additions and 11 deletions

View file

@ -20,6 +20,7 @@
#include "xportwrapper.h"
#include "andutils.h"
#include "dbgutil.h"
#include "paths.h"
typedef struct _AndTransportProcs {
@ -145,7 +146,7 @@ and_xport_sendNoConn( const XP_U8* buf, XP_U16 len, const XP_UCHAR* msgNo,
jbytes, jMsgNo, jRelayID );
deleteLocalRefs( env, jbytes, jRelayID, jMsgNo, DELETE_NO_REF );
}
LOG_RETURNF( "%d", result );
LOG_RETURNF( "%s", boolToStr(result) );
return result;
}

View file

@ -1,4 +1,4 @@
/* -*- compile-command: "find-and-ant.sh debug install"; -*- */
/* -*- compile-command: "find-and-gradle.sh installXw4Debug"; -*- */
/*
* Copyright © 2009 - 2014 by Eric House (xwords@eehouse.org). All rights
* reserved.
@ -29,6 +29,7 @@
#include "board.h"
#include "mempool.h"
#include "strutils.h"
#include "dbgutil.h"
#include "dictnry.h"
#include "dictiter.h"
#include "dictmgr.h"
@ -1507,7 +1508,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_server_1initClientConnection
stream_setOnCloseProc( stream, and_send_on_close );
result = server_initClientConnection( state->game.server, stream );
XWJNI_END();
LOG_RETURNF( "%d", result );
LOG_RETURNF( "%s", boolToStr(result) );
return result;
}

View file

@ -30,6 +30,7 @@
#include "memstream.h"
#include "xwrelay.h"
#include "strutils.h"
#include "dbgutil.h"
#define HEARTBEAT_NONE 0
@ -1812,7 +1813,7 @@ relayPreProcess( CommsCtxt* comms, XWStreamCtxt* stream, XWHostID* senderID )
XP_LOGF( "%s: dropping relay msg with cmd %d", __func__, (XP_U16)cmd );
}
LOG_RETURNF( "%d", consumed );
LOG_RETURNF( "%s", boolToStr(consumed) );
return consumed;
} /* relayPreProcess */
#endif
@ -1893,7 +1894,7 @@ preProcess( CommsCtxt* comms, const CommsAddrRec* useAddr,
XP_ASSERT(0);
break;
}
LOG_RETURNF( "%d", consumed );
LOG_RETURNF( "%s", boolToStr(consumed) );
return consumed;
} /* preProcess */
@ -1981,6 +1982,7 @@ getRecordFor( CommsCtxt* comms, const CommsAddrRec* addr,
static XP_Bool
checkChannelNo( CommsCtxt* comms, XP_PlayerAddr* channelNoP )
{
XP_Bool success = XP_TRUE;
XP_PlayerAddr channelNo = *channelNoP;
if ( 0 == (channelNo & CHANNEL_MASK) ) {
channelNo |= ++comms->nextChannelNo;
@ -1990,7 +1992,8 @@ checkChannelNo( CommsCtxt* comms, XP_PlayerAddr* channelNoP )
comms->nextChannelNo = channelNo;
}
*channelNoP = channelNo;
return XP_TRUE; /* for now */
LOG_RETURNF( "%s", boolToStr(success) );
return success;
}
/* An initial message comes only from a client to a server, and from the

View file

@ -37,6 +37,7 @@ void dbg_logstream( const XWStreamCtxt* stream, const char* func, int line );
# define XP_LOGSTREAM( s )
# endif
#define boolToStr(b) ((b)?"true" : "false")
# ifdef DEBUG
# define DIRTY_SLOT XP_Bool _isDirty;

View file

@ -23,6 +23,7 @@
#include "nli.h"
#include "comms.h"
#include "strutils.h"
#include "dbgutil.h"
void
nli_init( NetLaunchInfo* nli, const CurGameInfo* gi, const CommsAddrRec* addr,
@ -135,7 +136,7 @@ nli_makeFromStream( NetLaunchInfo* nli, XWStreamCtxt* stream )
nli->osVers = stream_getU32( stream );
}
}
LOG_RETURNF( "%d", success );
LOG_RETURNF( "%s", boolToStr(success) );
return success;
}

View file

@ -55,6 +55,7 @@
#include "game.h"
#include "movestak.h"
#include "strutils.h"
#include "dbgutil.h"
#include "gtkask.h"
#include "gtkinvit.h"
#include "gtkaskm.h"
@ -2819,7 +2820,7 @@ makeNewGame( GtkGameGlobals* globals )
gi->dictName, XP_TRUE );
gi->dictLang = dict_getLangCode( cGlobals->dict );
}
LOG_RETURNF( "%d", success );
LOG_RETURNF( "%s", boolToStr(success) );
return success;
}

View file

@ -68,6 +68,7 @@
#include "model.h"
#include "util.h"
#include "strutils.h"
#include "dbgutil.h"
#include "dictiter.h"
/* #include "commgr.h" */
/* #include "compipe.h" */
@ -1052,7 +1053,7 @@ send_or_close( CommonGlobals* cGlobals, const XP_U8* buf, size_t len )
g_slist_free( cGlobals->packetQueue );
cGlobals->packetQueue = NULL;
}
LOG_RETURNF( "%d", success );
LOG_RETURNF( "%s", boolToStr(success) );
return success;
}
@ -2664,4 +2665,3 @@ main( int argc, char** argv )
XP_LOGF( "%s exiting main, returning %d", argv[0], result );
return result;
} /* main */

View file

@ -195,7 +195,7 @@ remembered( const LinUDPStuff* stuff, int sock )
known = XP_TRUE;
}
}
LOG_RETURNF( "%d", (int)known );
LOG_RETURNF( "%s", boolToStr(known) );
return known;
}