diff --git a/xwords4/common/comms.c b/xwords4/common/comms.c index 19a0c7986..5e2a73dae 100644 --- a/xwords4/common/comms.c +++ b/xwords4/common/comms.c @@ -2704,7 +2704,7 @@ logAddrs( const CommsCtxt* comms, const char* caller ) #endif static void -augmentChannelAddr( CommsCtxt* comms, AddressRecord * const rec, +augmentChannelAddr( CommsCtxt* XP_UNUSED_DBG(comms), AddressRecord * const rec, const CommsAddrRec* addr, XWHostID hostID ) { if ( !!addr ) { diff --git a/xwords4/linux/cursesmain.c b/xwords4/linux/cursesmain.c index c02e5fe60..c1f6d7fa7 100644 --- a/xwords4/linux/cursesmain.c +++ b/xwords4/linux/cursesmain.c @@ -1372,8 +1372,8 @@ curses_util_getVTManager(XW_UtilCtxt* uc) static void curses_util_informNeedPassword( XW_UtilCtxt* XP_UNUSED(uc), - XP_U16 playerNum, - const XP_UCHAR* name ) + XP_U16 XP_UNUSED_DBG(playerNum), + const XP_UCHAR* XP_UNUSED_DBG(name) ) { XP_WARNF( "curses_util_informNeedPassword(num=%d, name=%s", playerNum, name ); } /* curses_util_askPassword */ @@ -1391,7 +1391,7 @@ curses_util_yOffsetChange( XW_UtilCtxt* XP_UNUSED(uc), #ifdef XWFEATURE_TURNCHANGENOTIFY static void -curses_util_turnChanged( XW_UtilCtxt* XP_UNUSED(uc), XP_S16 newTurn ) +curses_util_turnChanged( XW_UtilCtxt* XP_UNUSED(uc), XP_S16 XP_UNUSED_DBG(newTurn) ) { XP_LOGF( "%s(turn=%d)", __func__, newTurn ); } @@ -1725,7 +1725,7 @@ cursesGotBuf( void* closure, const CommsAddrRec* addr, static void cursesGotForRow( void* closure, const CommsAddrRec* from, - sqlite3_int64 rowid, const XP_U8* buf, + sqlite3_int64 XP_UNUSED_DBG(rowid), const XP_U8* buf, XP_U16 len ) { LOG_FUNC(); diff --git a/xwords4/linux/gamesdb.c b/xwords4/linux/gamesdb.c index 377a0dac0..123a3fb12 100644 --- a/xwords4/linux/gamesdb.c +++ b/xwords4/linux/gamesdb.c @@ -31,8 +31,8 @@ static void getColumnText( sqlite3_stmt *ppStmt, int iCol, XP_UCHAR* buf, int len ); #ifdef DEBUG static char* sqliteErr2str( int err ); -static void assertPrintResult( sqlite3* pDb, int result, int expect ); #endif +static void assertPrintResult( sqlite3* pDb, int result, int expect ); sqlite3* openGamesDB( const char* dbName ) @@ -590,17 +590,15 @@ sqliteErr2str( int err ) } return ""; } +#endif static void -assertPrintResult( sqlite3* pDb, int result, int expect ) +assertPrintResult( sqlite3* pDb, int XP_UNUSED_DBG(result), int expect ) { int code = sqlite3_errcode( pDb ); XP_ASSERT( code == result ); /* do I need to pass it? */ if ( code != expect ) { - const char* msg = sqlite3_errmsg( pDb ); - XP_LOGF( "sqlite3 error: %s", msg ); + XP_LOGF( "sqlite3 error: %s", sqlite3_errmsg( pDb ) ); XP_ASSERT(0); } } - -#endif diff --git a/xwords4/linux/gtkboard.c b/xwords4/linux/gtkboard.c index 0930e3935..1e506edea 100644 --- a/xwords4/linux/gtkboard.c +++ b/xwords4/linux/gtkboard.c @@ -435,7 +435,7 @@ tryConnectToServer(CommonGlobals* cGlobals) { LaunchParams* params = cGlobals->params; XWStreamCtxt* stream = - mem_stream_make( cGlobals->util->mpool, params->vtMgr, + mem_stream_make( MPPARM(cGlobals->util->mpool) params->vtMgr, cGlobals, CHANNEL_NONE, sendOnClose ); (void)server_initClientConnection( cGlobals->game.server, diff --git a/xwords4/linux/gtkdraw.c b/xwords4/linux/gtkdraw.c index fa04326ad..c2491466e 100644 --- a/xwords4/linux/gtkdraw.c +++ b/xwords4/linux/gtkdraw.c @@ -1460,8 +1460,7 @@ gtkDrawCtxtMake( GtkWidget* drawing_area, GtkGameGlobals* globals ) dctx->drawing_area = drawing_area; dctx->globals = globals; - GdkWindow* window = gtk_widget_get_window(drawing_area); - XP_ASSERT( !!window ); + XP_ASSERT( !!gtk_widget_get_window(drawing_area) ); #ifdef USE_CAIRO /* dctx->cairo = gdk_cairo_create( window ); */ /* XP_LOGF( "dctx->cairo=%p", dctx->cairo ); */ @@ -1514,6 +1513,7 @@ removeSurface( GtkDrawCtx* dctx ) dctx->surface = NULL; } +#ifdef DEBUG static cairo_status_t write_func( void *closure, const unsigned char *data, unsigned int length ) @@ -1522,16 +1522,19 @@ write_func( void *closure, const unsigned char *data, stream_putBytes( stream, data, length ); return CAIRO_STATUS_SUCCESS; } +#endif void -getImage( GtkDrawCtx* dctx, XWStreamCtxt* stream ) +getImage( GtkDrawCtx* XP_UNUSED_DBG(dctx), XWStreamCtxt* XP_UNUSED_DBG(stream) ) { LOG_FUNC(); XP_ASSERT( !!dctx->surface ); +#ifdef DEBUG cairo_status_t status = cairo_surface_write_to_png_stream( dctx->surface, write_func, stream ); XP_ASSERT( CAIRO_STATUS_SUCCESS == status ); +#endif } void diff --git a/xwords4/linux/linuxmain.c b/xwords4/linux/linuxmain.c index ffdc68917..3c992e2b6 100644 --- a/xwords4/linux/linuxmain.c +++ b/xwords4/linux/linuxmain.c @@ -1242,7 +1242,7 @@ linux_reset( void* closure ) #endif XP_S16 -linux_send( const XP_U8* buf, XP_U16 buflen, const XP_UCHAR* msgNo, +linux_send( const XP_U8* buf, XP_U16 buflen, const XP_UCHAR* XP_UNUSED_DBG(msgNo), const CommsAddrRec* addrRec, CommsConnType conType, XP_U32 gameID, void* closure ) { diff --git a/xwords4/linux/relaycon.c b/xwords4/linux/relaycon.c index 6f0c2a534..b156b268a 100644 --- a/xwords4/linux/relaycon.c +++ b/xwords4/linux/relaycon.c @@ -480,8 +480,9 @@ relayThread( void* arg ) while ( !storage->relayTaskList ) { pthread_cond_wait( &storage->relayCondVar, &storage->relayMutex ); } - +#ifdef DEBUG int len = g_slist_length( storage->relayTaskList ); +#endif gchar* strs = listTasks( storage->relayTaskList ); GSList* head = storage->relayTaskList; storage->relayTaskList = g_slist_remove_link( storage->relayTaskList, @@ -740,12 +741,16 @@ relaycon_cleanup( LaunchParams* params ) RelayConStorage* storage = (RelayConStorage*)params->relayConStorage; if ( storage->params->useHTTP ) { pthread_mutex_lock( &storage->relayMutex ); +#ifdef DEBUG int nRelayTasks = g_slist_length( storage->relayTaskList ); +#endif gchar* taskStrs = listTasks( storage->relayTaskList ); pthread_mutex_unlock( &storage->relayMutex ); pthread_mutex_lock( &storage->gotDataMutex ); +#ifdef DEBUG int nDataTasks = g_slist_length( storage->gotDataTaskList ); +#endif gchar* gotStrs = listTasks( storage->gotDataTaskList ); pthread_mutex_unlock( &storage->gotDataMutex ); @@ -905,17 +910,16 @@ onGotQueryData( RelayTask* task ) if ( !!reply ) { CommsAddrRec addr = {0}; addr_addType( &addr, COMMS_CONN_RELAY ); - +#ifdef DEBUG GList* ids = g_hash_table_get_keys( task->u.query.map ); - const char* xxx = ids->data; - +#endif json_object* jMsgs; if ( json_object_object_get_ex( reply, "msgs", &jMsgs ) ) { /* Currently there's an array of arrays for each relayID (value) */ XP_LOGF( "%s: got result of len %d", __func__, json_object_object_length(jMsgs) ); XP_ASSERT( json_object_object_length(jMsgs) <= 1 ); json_object_object_foreach(jMsgs, relayID, arrOfArrOfMoves) { - XP_ASSERT( 0 == strcmp( relayID, xxx ) ); + XP_ASSERT( 0 == strcmp( relayID, ids->data ) ); int len1 = json_object_array_length( arrOfArrOfMoves ); if ( len1 > 0 ) { sqlite3_int64 rowid = *(sqlite3_int64*)g_hash_table_lookup( task->u.query.map, relayID );