File tree Expand file tree Collapse file tree
libretro-common/include/string Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -64,7 +64,11 @@ static INLINE bool string_is_empty(const char *data)
6464
6565static INLINE bool string_is_equal (const char * a , const char * b )
6666{
67- return (a && b ) ? !strcmp (a , b ) : false;
67+ if (a == b )
68+ return true;
69+ if (!a || !b )
70+ return false;
71+ return !strcmp (a , b );
6872}
6973
7074static INLINE bool string_starts_with_size (const char * str , const char * prefix ,
@@ -109,24 +113,14 @@ static INLINE size_t strlen_size(const char *str, size_t len)
109113 return i ;
110114}
111115
112-
113116static INLINE bool string_is_equal_case_insensitive (const char * a ,
114117 const char * b )
115118{
116- int result = 0 ;
117- const unsigned char * p1 = (const unsigned char * )a ;
118- const unsigned char * p2 = (const unsigned char * )b ;
119-
119+ if (a == b )
120+ return true;
120121 if (!a || !b )
121122 return false;
122- if (p1 == p2 )
123- return true;
124-
125- while ((result = tolower (* p1 ) - tolower (* p2 ++ )) == 0 )
126- if (* p1 ++ == '\0' )
127- break ;
128-
129- return (result == 0 );
123+ return strcasecmp (a , b ) == 0 ;
130124}
131125
132126static INLINE bool string_starts_with_case_insensitive (const char * str ,
You can’t perform that action at this time.
0 commit comments