From: Tom Hughes Date: Fri, 12 Nov 2010 10:40:20 +0000 (+0000) Subject: Rework the strcasecmp stuff a little, based on Jakub Jelinek's patch X-Git-Tag: svn/VALGRIND_3_7_0~721 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d0687af4c6122171d431f51d8eaf02e48befc36e;p=thirdparty%2Fvalgrind.git Rework the strcasecmp stuff a little, based on Jakub Jelinek's patch on bug #256600 because the original version turned out to somewhat fragile across different glibc versions. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11479 --- diff --git a/configure.in b/configure.in index 130d229891..cfe9b8a32e 100644 --- a/configure.in +++ b/configure.in @@ -1549,7 +1549,6 @@ AC_CHECK_FUNCS([ \ strstr \ syscall \ timerfd \ - tolower_l \ utimensat \ ]) diff --git a/memcheck/mc_replace_strmem.c b/memcheck/mc_replace_strmem.c index 64cb7849c0..ebef4d8e43 100644 --- a/memcheck/mc_replace_strmem.c +++ b/memcheck/mc_replace_strmem.c @@ -35,13 +35,10 @@ #include "pub_tool_redir.h" #include "pub_tool_tooliface.h" #include "valgrind.h" -#include "config.h" #include "mc_include.h" #include "memcheck.h" -#include - /* --------------------------------------------------------------------- We have our own versions of these functions for two reasons: (a) it allows us to do overlap checking @@ -412,6 +409,7 @@ STRNCMP(VG_Z_DYLD, strncmp) int VG_REPLACE_FUNCTION_ZU(soname,fnname) \ ( const char* s1, const char* s2 ) \ { \ + extern int tolower(int); \ register unsigned char c1; \ register unsigned char c2; \ while (True) { \ @@ -438,6 +436,7 @@ STRCASECMP(VG_Z_LIBC_SONAME, __GI_strcasecmp) int VG_REPLACE_FUNCTION_ZU(soname,fnname) \ ( const char* s1, const char* s2, SizeT nmax ) \ { \ + extern int tolower(int); \ SizeT n = 0; \ while (True) { \ if (n >= nmax) return 0; \ @@ -460,15 +459,13 @@ STRNCASECMP(VG_Z_DYLD, strncasecmp) #endif -#ifdef HAVE_TOLOWER_L - - #define STRCASECMP_L(soname, fnname) \ int VG_REPLACE_FUNCTION_ZU(soname,fnname) \ - ( const char* s1, const char* s2, locale_t locale ); \ + ( const char* s1, const char* s2, void* locale ); \ int VG_REPLACE_FUNCTION_ZU(soname,fnname) \ - ( const char* s1, const char* s2, locale_t locale ) \ + ( const char* s1, const char* s2, void* locale ) \ { \ + extern int tolower_l(int, void*) __attribute__((weak)); \ register unsigned char c1; \ register unsigned char c2; \ while (True) { \ @@ -491,10 +488,11 @@ STRCASECMP_L(VG_Z_LIBC_SONAME, __GI_strcasecmp_l) #define STRNCASECMP_L(soname, fnname) \ int VG_REPLACE_FUNCTION_ZU(soname,fnname) \ - ( const char* s1, const char* s2, SizeT nmax, locale_t locale ); \ + ( const char* s1, const char* s2, SizeT nmax, void* locale ); \ int VG_REPLACE_FUNCTION_ZU(soname,fnname) \ - ( const char* s1, const char* s2, SizeT nmax, locale_t locale ) \ + ( const char* s1, const char* s2, SizeT nmax, void* locale ) \ { \ + extern int tolower_l(int, void*) __attribute__((weak)); \ SizeT n = 0; \ while (True) { \ if (n >= nmax) return 0; \ @@ -517,9 +515,6 @@ STRNCASECMP_L(VG_Z_DYLD, strncasecmp_l) #endif -#endif - - #define STRCMP(soname, fnname) \ int VG_REPLACE_FUNCTION_ZU(soname,fnname) \ ( const char* s1, const char* s2 ); \