Changeset - r21408:191df1452902
[Not reviewed]
master
0 2 0
rubidium - 10 years ago 2014-04-25 15:17:17
rubidium@openttd.org
(svn r26507) -Cleanup: remove now unused custom strndup implementation
2 files changed with 0 insertions and 18 deletions:
0 comments (0 inline, 0 general)
src/string.cpp
Show inline comments
 
@@ -525,22 +525,12 @@ size_t Utf8TrimString(char *s, size_t ma
 
	}
 

	
 
	*s = '\0';
 
	return length;
 
}
 

	
 
#ifdef DEFINE_STRNDUP
 
char *strndup(const char *s, size_t len)
 
{
 
	len = ttd_strnlen(s, len);
 
	char *tmp = CallocT<char>(len + 1);
 
	memcpy(tmp, s, len);
 
	return tmp;
 
}
 
#endif /* DEFINE_STRNDUP */
 

	
 
#ifdef DEFINE_STRCASESTR
 
char *strcasestr(const char *haystack, const char *needle)
 
{
 
	size_t hay_len = strlen(haystack);
 
	size_t needle_len = strlen(needle);
 
	while (hay_len >= needle_len) {
src/string_func.h
Show inline comments
 
@@ -244,20 +244,12 @@ static inline bool IsWhitespace(WChar c)
 

	
 
/* Needed for NetBSD version (so feature) testing */
 
#if defined(__NetBSD__) || defined(__FreeBSD__)
 
#include <sys/param.h>
 
#endif
 

	
 
/* strndup is a GNU extension */
 
#if defined(_GNU_SOURCE) || (defined(__NetBSD_Version__) && 400000000 <= __NetBSD_Version__) || (defined(__FreeBSD_version) && 701101 <= __FreeBSD_version) || (defined(__DARWIN_C_LEVEL) && __DARWIN_C_LEVEL >= 200809L)
 
#	undef DEFINE_STRNDUP
 
#else
 
#	define DEFINE_STRNDUP
 
char *strndup(const char *s, size_t len);
 
#endif /* strndup is available */
 

	
 
/* 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))) || defined(_NETBSD_SOURCE)
 
#	undef DEFINE_STRCASESTR
 
#else
 
#	define DEFINE_STRCASESTR
 
char *strcasestr(const char *haystack, const char *needle);
0 comments (0 inline, 0 general)