Use strcasecmp when available
This commit is contained in:
parent
b6a3735f53
commit
484a2a705d
|
@ -856,6 +856,12 @@ help:always wipe certain freed memory
|
||||||
poison = True
|
poison = True
|
||||||
if poison:
|
if poison:
|
||||||
context.sconf.Define('DXX_HAVE_POISON')
|
context.sconf.Define('DXX_HAVE_POISON')
|
||||||
|
@_custom_test
|
||||||
|
def check_strcasecmp_present(self,context):
|
||||||
|
main = '''
|
||||||
|
return !strcasecmp(argv[0], argv[0] + 1) && !strncasecmp(argv[0] + 1, argv[0], 1);
|
||||||
|
'''
|
||||||
|
self.Compile(context, text='#include <cstring>', main=main, msg='for strcasecmp', successflags={'CPPDEFINES' : ['DXX_HAVE_STRCASECMP']})
|
||||||
|
|
||||||
class LazyObjectConstructor:
|
class LazyObjectConstructor:
|
||||||
def __get_lazy_object(self,srcname,transform_target):
|
def __get_lazy_object(self,srcname,transform_target):
|
||||||
|
|
|
@ -15,10 +15,19 @@
|
||||||
#define snprintf macintosh_snprintf
|
#define snprintf macintosh_snprintf
|
||||||
extern void snprintf(char *out_string, int size, const char * format, ... );
|
extern void snprintf(char *out_string, int size, const char * format, ... );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef DXX_HAVE_STRCASECMP
|
||||||
|
#define d_stricmp strcasecmp
|
||||||
|
static inline int d_strnicmp(const char *s1, const char *s2, size_t n)
|
||||||
|
{
|
||||||
|
return strncasecmp(s1, s2, n);
|
||||||
|
}
|
||||||
|
#else
|
||||||
__attribute_nonnull()
|
__attribute_nonnull()
|
||||||
extern int d_stricmp( const char *s1, const char *s2 );
|
extern int d_stricmp( const char *s1, const char *s2 );
|
||||||
__attribute_nonnull()
|
__attribute_nonnull()
|
||||||
int d_strnicmp(const char *s1, const char *s2, uint_fast32_t n);
|
int d_strnicmp(const char *s1, const char *s2, uint_fast32_t n);
|
||||||
|
#endif
|
||||||
extern void d_strlwr( char *s1 );
|
extern void d_strlwr( char *s1 );
|
||||||
extern void d_strupr( char *s1 );
|
extern void d_strupr( char *s1 );
|
||||||
extern void d_strrev( char *s1 );
|
extern void d_strrev( char *s1 );
|
||||||
|
|
|
@ -56,6 +56,7 @@ void snprintf(char *out_string, int size, char * format, ... )
|
||||||
|
|
||||||
// string compare without regard to case
|
// string compare without regard to case
|
||||||
|
|
||||||
|
#ifndef DXX_HAVE_STRCASECMP
|
||||||
int d_stricmp( const char *s1, const char *s2 )
|
int d_stricmp( const char *s1, const char *s2 )
|
||||||
{
|
{
|
||||||
for (;; ++s1, ++s2)
|
for (;; ++s1, ++s2)
|
||||||
|
@ -82,6 +83,7 @@ int d_strnicmp(const char *s1, const char *s2, uint_fast32_t n)
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void d_strlwr( char *s1 )
|
void d_strlwr( char *s1 )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue