diff --git a/engine/common/common.c b/engine/common/common.c index 684718dd..45756357 100644 --- a/engine/common/common.c +++ b/engine/common/common.c @@ -151,6 +151,30 @@ int GAME_EXPORT COM_RandomLong( int lLow, int lHigh ) return lLow + (n % x); } +/* +============ +va + +does a varargs printf into a temp buffer, +so I don't need to have varargs versions +of all text functions. +============ +*/ +char *va( const char *format, ... ) +{ + va_list argptr; + static char string[16][MAX_VA_STRING], *s; + static int stringindex = 0; + + s = string[stringindex]; + stringindex = (stringindex + 1) & 15; + va_start( argptr, format ); + Q_vsnprintf( s, sizeof( string[0] ), format, argptr ); + va_end( argptr ); + + return s; +} + /* =============================================================================== diff --git a/engine/common/common.h b/engine/common/common.h index 2ff09685..e80d8eea 100644 --- a/engine/common/common.h +++ b/engine/common/common.h @@ -844,6 +844,7 @@ void COM_NormalizeAngles( vec3_t angles ); int COM_FileSize( const char *filename ); void COM_FreeFile( void *buffer ); int COM_CompareFileTime( const char *filename1, const char *filename2, int *iCompare ); +char *va( const char *format, ... ) _format( 1 ); // soundlib shared exports qboolean S_Init( void ); diff --git a/public/crtlib.c b/public/crtlib.c index 2a67f476..4ca8484a 100644 --- a/public/crtlib.c +++ b/public/crtlib.c @@ -619,30 +619,6 @@ char *Q_pretifymem( float value, int digitsafterdecimal ) return out; } -/* -============ -va - -does a varargs printf into a temp buffer, -so I don't need to have varargs versions -of all text functions. -============ -*/ -char *va( const char *format, ... ) -{ - va_list argptr; - static char string[16][MAX_VA_STRING], *s; - static int stringindex = 0; - - s = string[stringindex]; - stringindex = (stringindex + 1) & 15; - va_start( argptr, format ); - Q_vsnprintf( s, sizeof( string[0] ), format, argptr ); - va_end( argptr ); - - return s; -} - /* ============ COM_FileBase diff --git a/public/crtlib.h b/public/crtlib.h index 4f159584..5c4187a5 100644 --- a/public/crtlib.h +++ b/public/crtlib.h @@ -90,7 +90,6 @@ int Q_sprintf( char *buffer, const char *format, ... ) _format( 2 ); void COM_StripColors( const char *in, char *out ); #define Q_memprint( val ) Q_pretifymem( val, 2 ) char *Q_pretifymem( float value, int digitsafterdecimal ); -char *va( const char *format, ... ) _format( 1 ); void COM_FileBase( const char *in, char *out ); const char *COM_FileExtension( const char *in ); void COM_DefaultExtension( char *path, const char *extension );