summaryrefslogtreecommitdiff
path: root/src/ui
diff options
context:
space:
mode:
authorM. Kristall <mkpdev@gmail.com>2012-07-12 02:46:19 +0000
committerTim Angus <tim@ngus.net>2013-01-03 00:18:16 +0000
commit8d448680f5b3bcd2a67a3684308bb948e4d3ddad (patch)
tree8ec357b00c06d7b2e851680270690ad8e5ee3504 /src/ui
parent156289dcdd27a31e77afb36147d456bac9be72a3 (diff)
* (bug 5000) refactor: use ARRAY_LEN; remove undefined functions; more size_t
(/dev/humancontroller)
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/ui_atoms.c2
-rw-r--r--src/ui/ui_main.c8
-rw-r--r--src/ui/ui_shared.c4
3 files changed, 7 insertions, 7 deletions
diff --git a/src/ui/ui_atoms.c b/src/ui/ui_atoms.c
index af3a3ef8..fd52fdaa 100644
--- a/src/ui/ui_atoms.c
+++ b/src/ui/ui_atoms.c
@@ -213,7 +213,7 @@ UI_ConsoleCommand
qboolean UI_ConsoleCommand( int realTime )
{
struct uicmd *cmd = bsearch( UI_Argv( 0 ), commands,
- sizeof( commands ) / sizeof( commands[ 0 ] ), sizeof( commands[ 0 ] ),
+ ARRAY_LEN( commands ), sizeof( commands[ 0 ] ),
cmdcmp );
uiInfo.uiDC.frameTime = realTime - uiInfo.uiDC.realTime;
diff --git a/src/ui/ui_main.c b/src/ui/ui_main.c
index 8edcccae..eb96c4c5 100644
--- a/src/ui/ui_main.c
+++ b/src/ui/ui_main.c
@@ -49,7 +49,7 @@ static const char *netSources[ ] =
"Favorites"
};
-static const int numNetSources = sizeof( netSources ) / sizeof( const char* );
+static const size_t numNetSources = ARRAY_LEN( netSources );
static const char *netnames[ ] =
{
@@ -127,7 +127,7 @@ static cvarTable_t cvarTable[ ] =
{ &ui_chatCommands, "ui_chatCommands", "1", CVAR_ARCHIVE }
};
-static int cvarTableSize = sizeof( cvarTable ) / sizeof( cvarTable[0] );
+static size_t cvarTableSize = ARRAY_LEN( cvarTable );
/*
================
@@ -2689,11 +2689,11 @@ static void UI_LoadDemos( void )
char *demoname;
int i, len;
- Com_sprintf( demoExt, sizeof( demoExt ), "dm_%d", ( int )trap_Cvar_VariableValue( "protocol" ) );
+ Com_sprintf( demoExt, sizeof( demoExt ), "%s%d", DEMOEXT, (int)trap_Cvar_VariableValue( "protocol" ) );
uiInfo.demoCount = trap_FS_GetFileList( "demos", demoExt, demolist, 4096 );
- Com_sprintf( demoExt, sizeof( demoExt ), ".dm_%d", ( int )trap_Cvar_VariableValue( "protocol" ) );
+ Com_sprintf( demoExt, sizeof( demoExt ), ".%s%d", DEMOEXT, (int)trap_Cvar_VariableValue( "protocol" ) );
if( uiInfo.demoCount )
{
diff --git a/src/ui/ui_shared.c b/src/ui/ui_shared.c
index 24dc201e..1cd922ad 100644
--- a/src/ui/ui_shared.c
+++ b/src/ui/ui_shared.c
@@ -2364,7 +2364,7 @@ commandDef_t commandList[] =
{"transition", &Script_Transition}, // group/name
};
-static size_t scriptCommandCount = sizeof( commandList ) / sizeof( commandDef_t );
+static size_t scriptCommandCount = ARRAY_LEN( commandList );
// despite what lcc thinks, we do not get cmdcmp here
static int commandComp( const void *a, const void *b )
@@ -4977,7 +4977,7 @@ static bind_t g_bindings[] =
};
-static const int g_bindCount = sizeof( g_bindings ) / sizeof( bind_t );
+static const size_t g_bindCount = ARRAY_LEN( g_bindings );
/*
=================