public: replace COM_CheckString and COM_CheckStringEmpty by COM_StringEmptyOrNULL and COM_StringEmpty. Remove legacy macros

This commit is contained in:
Alibek Omarov
2026-02-21 00:06:30 +05:00
committed by a1batross
parent 4722ad6be6
commit 6bcb98e779
2 changed files with 6 additions and 8 deletions

View File

@@ -68,12 +68,12 @@ int Q_atoi( const char *str )
int val = 0;
int c, sign;
if( !COM_CheckString( str ))
if( COM_StringEmptyOrNULL( str ))
return 0;
str = Q_atoi_strip_whitespace( str );
if( !COM_CheckString( str ))
if( COM_StringEmptyOrNULL( str ))
return 0;
if( *str == '-' )
@@ -107,12 +107,12 @@ float Q_atof( const char *str )
double val = 0;
int c, sign, decimal, total;
if( !COM_CheckString( str ))
if( COM_StringEmptyOrNULL( str ))
return 0;
str = Q_atoi_strip_whitespace( str );
if( !COM_CheckString( str ))
if( COM_StringEmptyOrNULL( str ))
return 0;
if( *str == '-' )
@@ -468,7 +468,7 @@ void COM_FileBase( const char *in, char *out, size_t size )
const char *dot, *slash, *s;
size_t len;
if( unlikely( !COM_CheckString( in ) || size <= 1 ))
if( unlikely( COM_StringEmptyOrNULL( in ) || size <= 1 ))
{
out[0] = 0;
return;

View File

@@ -94,10 +94,8 @@ const char *COM_FileWithoutPath( const char *in );
void COM_StripExtension( char *path );
void COM_RemoveLineFeed( char *str, size_t bufsize );
void COM_PathSlashFix( char *path );
// return 0 on empty or null string, 1 otherwise
#define COM_CheckString( string ) ( ( !string || !*string ) ? 0 : 1 )
#define COM_CheckStringEmpty( string ) ( ( !*string ) ? 0 : 1 )
// returns true on empty or NULL string, false otherwise
#define COM_StringEmpty( string ) (( string )[0] ? false : true )
#define COM_StringEmptyOrNULL( string ) (( string ) && ( string )[0] ? false : true )