]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Merge from trunk, r12893 (Implement a wrapper for wcslen on Linux, #298281)
authorJulian Seward <jseward@acm.org>
Sun, 2 Sep 2012 20:52:10 +0000 (20:52 +0000)
committerJulian Seward <jseward@acm.org>
Sun, 2 Sep 2012 20:52:10 +0000 (20:52 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/branches/VALGRIND_3_8_BRANCH@12943

memcheck/mc_replace_strmem.c

index 6c0e08b8e22ca2f26ffdbfdb03154616e4c0a61f..b5b6b5d680fa15cbcac0d33cf7f07551d8366d6d 100644 (file)
@@ -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  ---*/
 /*------------------------------------------------------------*/