Changeset - r11036:64a843b9f543
[Not reviewed]
master
0 2 0
rubidium - 15 years ago 2009-02-06 15:53:48
rubidium@openttd.org
(svn r15376) -Fix [FS#2608] (r15371): OSX/BSD also seems to define strcasecmp under some circumstances.
2 files changed with 12 insertions and 3 deletions:
0 comments (0 inline, 0 general)
src/string.cpp
Show inline comments
 
@@ -362,7 +362,9 @@ char *strndup(const char *s, size_t len)
 
	memcpy(tmp, s, len);
 
	return tmp;
 
}
 
#endif /* !_GNU_SOURCE */
 

	
 
#ifdef DEFINE_STRCASESTR
 
const char *strcasestr(const char *haystack, const char *needle)
 
{
 
	size_t hay_len = strlen(haystack);
 
@@ -376,4 +378,4 @@ const char *strcasestr(const char *hayst
 

	
 
	return NULL;
 
}
 
#endif /* !_GNU_SOURCE */
 
#endif /* DEFINE_STRCASESTR */
src/string_func.h
Show inline comments
 
@@ -234,9 +234,16 @@ static inline bool IsWhitespace(WChar c)
 
}
 

	
 
#ifndef _GNU_SOURCE
 
/* strndup and strcasestr are GNU extensions */
 
/* strndup is a GNU extension */
 
char *strndup(const char *s, size_t len);
 
const char *strcasestr(const char *haystack, const char *needle);
 
#endif /* !_GNU_SOURCE */
 

	
 
/* strcasestr is available for _GNU_SOURCE, BSD and some Apple */
 
#if defined(_GNU_SOURCE) || (defined(__BSD_VISIBLE) && __BSD_VISIBLE) || (defined(__APPLE__) && (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)))
 
#	undef DEFINE_STRCASESTR
 
#else
 
#	define DEFINE_STRCASESTR
 
const char *strcasestr(const char *haystack, const char *needle);
 
#endif /* strcasestr is available */
 

	
 
#endif /* STRING_FUNC_H */
0 comments (0 inline, 0 general)