diff options
author | Andrey Nazarov <skuller@skuller.net> | 2007-12-07 17:29:24 +0000 |
---|---|---|
committer | Andrey Nazarov <skuller@skuller.net> | 2007-12-07 17:29:24 +0000 |
commit | 439dd89a479e2d02fa40a421849c73616f92198e (patch) | |
tree | 96731a474ea0198a611f5fa03bcb360119d212a2 /source/ui_atoms.c | |
parent | 5c30b8152eb6a0fae6e50dbd834d73a2846df4ec (diff) |
Optimized FS_ListFiles (and broken Windows build).
Initial changes to demo browser to support caching.
Diffstat (limited to 'source/ui_atoms.c')
-rw-r--r-- | source/ui_atoms.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/source/ui_atoms.c b/source/ui_atoms.c index d1346b6..66e2629 100644 --- a/source/ui_atoms.c +++ b/source/ui_atoms.c @@ -243,7 +243,7 @@ UI_FormatColumns char *UI_FormatColumns( int numArgs, ... ) { va_list argptr; char *buffer, *p; - int i, totalLength; + int i, total = 0; char *strings[MAX_COLUMNS]; int lengths[MAX_COLUMNS]; @@ -251,26 +251,22 @@ char *UI_FormatColumns( int numArgs, ... ) { Com_Error( ERR_FATAL, "UI_FormatColumns: too many columns" ); } - totalLength = 0; - va_start( argptr, numArgs ); for( i = 0; i < numArgs; i++ ) { strings[i] = va_arg( argptr, char * ); lengths[i] = strlen( strings[i] ) + 1; - totalLength += lengths[i]; + total += lengths[i]; } va_end( argptr ); - buffer = p = UI_Malloc( totalLength + 1 ); + buffer = p = UI_Malloc( total + 1 ); for( i = 0; i < numArgs; i++ ) { memcpy( p, strings[i], lengths[i] ); p += lengths[i]; } - *p = 0; return buffer; - } /* |