From: Julian Seward Date: Sun, 2 Sep 2012 20:52:10 +0000 (+0000) Subject: Merge from trunk, r12893 (Implement a wrapper for wcslen on Linux, #298281) X-Git-Tag: svn/VALGRIND_3_8_1~14 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3e69b319943e3207ad2f3e8b0c05f577335ee05e;p=thirdparty%2Fvalgrind.git Merge from trunk, r12893 (Implement a wrapper for wcslen on Linux, #298281) git-svn-id: svn://svn.valgrind.org/valgrind/branches/VALGRIND_3_8_BRANCH@12943 --- diff --git a/memcheck/mc_replace_strmem.c b/memcheck/mc_replace_strmem.c index 6c0e08b8e2..b5b6b5d680 100644 --- a/memcheck/mc_replace_strmem.c +++ b/memcheck/mc_replace_strmem.c @@ -96,6 +96,7 @@ 20340 STRSPN 20350 STRCASESTR 20360 MEMRCHR + 20370 WCSLEN */ @@ -1543,6 +1544,32 @@ static inline void my_exit ( int x ) #endif +/*---------------------- wcslen ----------------------*/ + +// This is a wchar_t equivalent to strlen. Unfortunately +// we don't have wchar_t available here, but it looks like +// a 32 bit int on Linux. I don't know if that is also +// valid on MacOSX. + +#define WCSLEN(soname, fnname) \ + SizeT VG_REPLACE_FUNCTION_EZU(20370,soname,fnname) \ + ( const UInt* str ); \ + SizeT VG_REPLACE_FUNCTION_EZU(20370,soname,fnname) \ + ( const UInt* str ) \ + { \ + SizeT i = 0; \ + while (str[i] != 0) i++; \ + return i; \ + } + +#if defined(VGO_linux) + WCSLEN(VG_Z_LIBC_SONAME, wcslen) + +#elif defined(VGO_darwin) + +#endif + + /*------------------------------------------------------------*/ /*--- Improve definedness checking of process environment ---*/ /*------------------------------------------------------------*/