mirror of
https://github.com/FWGS/xash3d-fwgs.git
synced 2026-08-05 03:24:56 +08:00
public: replace COM_CheckString and COM_CheckStringEmpty by COM_StringEmptyOrNULL and COM_StringEmpty. Remove legacy macros
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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 )
|
||||
|
||||
|
||||
Reference in New Issue
Block a user