From 1048073e2624102dff884c38d5f6417ae860b2f5 Mon Sep 17 00:00:00 2001 From: Zack Middleton Date: Wed, 7 Jun 2017 19:16:05 -0500 Subject: [PATCH] Unify checks for missing COM_Parse() token --- code/cgame/cg_main.c | 4 ++-- code/cgame/cg_servercmds.c | 10 +++++----- code/q3_ui/ui_startserver.c | 2 +- code/ui/ui_main.c | 14 +++++++------- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/code/cgame/cg_main.c b/code/cgame/cg_main.c index d5ecd81f..780ed3e7 100644 --- a/code/cgame/cg_main.c +++ b/code/cgame/cg_main.c @@ -1417,7 +1417,7 @@ qboolean CG_Load_Menu(char **p) { return qtrue; } - if ( !token || token[0] == 0 ) { + if (!token[0]) { return qfalse; } @@ -1464,7 +1464,7 @@ void CG_LoadMenus(const char *menuFile) { while ( 1 ) { token = COM_ParseExt( &p, qtrue ); - if( !token || token[0] == 0 || token[0] == '}') { + if (!token[0]) { break; } diff --git a/code/cgame/cg_servercmds.c b/code/cgame/cg_servercmds.c index e863edca..d1c8b28b 100644 --- a/code/cgame/cg_servercmds.c +++ b/code/cgame/cg_servercmds.c @@ -566,7 +566,7 @@ int CG_ParseVoiceChats( const char *filename, voiceChatList_t *voiceChatList, in voiceChats[i].id[0] = 0; } token = COM_ParseExt(p, qtrue); - if (!token || token[0] == 0) { + if (!token[0]) { return qtrue; } if (!Q_stricmp(token, "female")) { @@ -586,7 +586,7 @@ int CG_ParseVoiceChats( const char *filename, voiceChatList_t *voiceChatList, in voiceChatList->numVoiceChats = 0; while ( 1 ) { token = COM_ParseExt(p, qtrue); - if (!token || token[0] == 0) { + if (!token[0]) { return qtrue; } Com_sprintf(voiceChats[voiceChatList->numVoiceChats].id, sizeof( voiceChats[voiceChatList->numVoiceChats].id ), "%s", token); @@ -598,7 +598,7 @@ int CG_ParseVoiceChats( const char *filename, voiceChatList_t *voiceChatList, in voiceChats[voiceChatList->numVoiceChats].numSounds = 0; while(1) { token = COM_ParseExt(p, qtrue); - if (!token || token[0] == 0) { + if (!token[0]) { return qtrue; } if (!Q_stricmp(token, "}")) @@ -606,7 +606,7 @@ int CG_ParseVoiceChats( const char *filename, voiceChatList_t *voiceChatList, in sound = trap_S_RegisterSound( token, compress ); voiceChats[voiceChatList->numVoiceChats].sounds[voiceChats[voiceChatList->numVoiceChats].numSounds] = sound; token = COM_ParseExt(p, qtrue); - if (!token || token[0] == 0) { + if (!token[0]) { return qtrue; } Com_sprintf(voiceChats[voiceChatList->numVoiceChats].chats[ @@ -674,7 +674,7 @@ int CG_HeadModelVoiceChats( char *filename ) { p = &ptr; token = COM_ParseExt(p, qtrue); - if (!token || token[0] == 0) { + if ( !token[0] ) { return -1; } diff --git a/code/q3_ui/ui_startserver.c b/code/q3_ui/ui_startserver.c index cb09a3b4..82865ad5 100644 --- a/code/q3_ui/ui_startserver.c +++ b/code/q3_ui/ui_startserver.c @@ -119,7 +119,7 @@ static int GametypeBits( char *string ) { p = string; while( 1 ) { token = COM_ParseExt( &p, qfalse ); - if( token[0] == 0 ) { + if ( !token[0] ) { break; } diff --git a/code/ui/ui_main.c b/code/ui/ui_main.c index bb43ec44..60170614 100644 --- a/code/ui/ui_main.c +++ b/code/ui/ui_main.c @@ -4549,7 +4549,7 @@ static qboolean Team_Parse(char **p) { return qtrue; } - if ( !token || token[0] == 0 ) { + if (!token[0]) { return qfalse; } @@ -4610,7 +4610,7 @@ static qboolean Character_Parse(char **p) { return qtrue; } - if ( !token || token[0] == 0 ) { + if (!token[0]) { return qfalse; } @@ -4666,7 +4666,7 @@ static qboolean Alias_Parse(char **p) { return qtrue; } - if ( !token || token[0] == 0 ) { + if (!token[0]) { return qfalse; } @@ -4715,7 +4715,7 @@ static void UI_ParseTeamInfo(const char *teamFile) { while ( 1 ) { token = COM_ParseExt( &p, qtrue ); - if( !token || token[0] == 0 || token[0] == '}') { + if (!token[0] || token[0] == '}') { break; } @@ -4767,7 +4767,7 @@ static qboolean GameType_Parse(char **p, qboolean join) { return qtrue; } - if ( !token || token[0] == 0 ) { + if (!token[0]) { return qfalse; } @@ -4824,7 +4824,7 @@ static qboolean MapList_Parse(char **p) { return qtrue; } - if ( !token || token[0] == 0 ) { + if (!token[0]) { return qfalse; } @@ -4885,7 +4885,7 @@ static void UI_ParseGameInfo(const char *teamFile) { while ( 1 ) { token = COM_ParseExt( &p, qtrue ); - if( !token || token[0] == 0 || token[0] == '}') { + if (!token[0] || token[0] == '}') { break; }