From 8d448680f5b3bcd2a67a3684308bb948e4d3ddad Mon Sep 17 00:00:00 2001 From: "M. Kristall" Date: Thu, 12 Jul 2012 02:46:19 +0000 Subject: * (bug 5000) refactor: use ARRAY_LEN; remove undefined functions; more size_t (/dev/humancontroller) --- src/cgame/cg_consolecmds.c | 4 ++-- src/cgame/cg_local.h | 2 +- src/cgame/cg_main.c | 3 +-- src/cgame/cg_servercmds.c | 5 ++--- src/cgame/cg_tutorial.c | 2 +- 5 files changed, 7 insertions(+), 9 deletions(-) (limited to 'src/cgame') diff --git a/src/cgame/cg_consolecmds.c b/src/cgame/cg_consolecmds.c index 19216eea..5dab9757 100644 --- a/src/cgame/cg_consolecmds.c +++ b/src/cgame/cg_consolecmds.c @@ -211,7 +211,7 @@ qboolean CG_ConsoleCommand( void ) consoleCommand_t *cmd; cmd = bsearch( CG_Argv( 0 ), commands, - sizeof( commands ) / sizeof( commands[ 0 ]), sizeof( commands[ 0 ] ), + ARRAY_LEN( commands ), sizeof( commands[ 0 ] ), cmdcmp ); if( !cmd ) @@ -234,7 +234,7 @@ void CG_InitConsoleCommands( void ) { int i; - for( i = 0 ; i < sizeof( commands ) / sizeof( commands[ 0 ] ) ; i++ ) + for( i = 0; i < ARRAY_LEN( commands ); i++ ) trap_AddCommand( commands[ i ].cmd ); // diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h index 36d7a870..797d0c2c 100644 --- a/src/cgame/cg_local.h +++ b/src/cgame/cg_local.h @@ -722,7 +722,7 @@ typedef struct { qboolean infoValid; - char name[ MAX_QPATH ]; + char name[ MAX_NAME_LENGTH ]; team_t team; int score; // updated by score servercmds diff --git a/src/cgame/cg_main.c b/src/cgame/cg_main.c index 3972097e..fd2d258f 100644 --- a/src/cgame/cg_main.c +++ b/src/cgame/cg_main.c @@ -357,7 +357,7 @@ static cvarTable_t cvarTable[ ] = { &cg_chatTeamPrefix, "cg_chatTeamPrefix", "1", CVAR_ARCHIVE} }; -static int cvarTableSize = sizeof( cvarTable ) / sizeof( cvarTable[0] ); +static size_t cvarTableSize = ARRAY_LEN( cvarTable ); /* ================= @@ -1738,7 +1738,6 @@ void CG_Init( int serverMessageNum, int serverCommandSequence, int clientNum ) // clear everything memset( &cgs, 0, sizeof( cgs ) ); memset( &cg, 0, sizeof( cg ) ); - memset( &cg.pmext, 0, sizeof( cg.pmext ) ); memset( cg_entities, 0, sizeof( cg_entities ) ); cg.clientNum = clientNum; diff --git a/src/cgame/cg_servercmds.c b/src/cgame/cg_servercmds.c index e1da8399..64ef7985 100644 --- a/src/cgame/cg_servercmds.c +++ b/src/cgame/cg_servercmds.c @@ -1292,9 +1292,8 @@ static void CG_ServerCommand( void ) consoleCommand_t *command; cmd = CG_Argv( 0 ); - command = bsearch( cmd, svcommands, sizeof( svcommands ) / - sizeof( svcommands[ 0 ]), sizeof( svcommands[ 0 ] ), - cmdcmp ); + command = bsearch( cmd, svcommands, ARRAY_LEN( svcommands ), + sizeof( svcommands[ 0 ] ), cmdcmp ); if( command ) { diff --git a/src/cgame/cg_tutorial.c b/src/cgame/cg_tutorial.c index 6839c3a1..7820f4fa 100644 --- a/src/cgame/cg_tutorial.c +++ b/src/cgame/cg_tutorial.c @@ -50,7 +50,7 @@ static bind_t bindings[ ] = { "weapnext", "Next Upgrade", { -1, -1 } } }; -static const int numBindings = sizeof( bindings ) / sizeof( bind_t ); +static const size_t numBindings = ARRAY_LEN( bindings ); /* ================= -- cgit