|
From: <sv...@va...> - 2012-08-24 14:44:35
|
sewardj 2012-08-24 15:44:27 +0100 (Fri, 24 Aug 2012)
New Revision: 12893
Log:
Implement a wrapper for wcslen on Linux, assuming that
sizeof(wchar_t) == 4, which I believe to be true on both Linux
and MacOSX. Fixes #298281.
Modified files:
trunk/memcheck/mc_replace_strmem.c
Modified: trunk/memcheck/mc_replace_strmem.c (+27 -0)
===================================================================
--- trunk/memcheck/mc_replace_strmem.c 2012-08-24 15:38:56 +01:00 (rev 12892)
+++ trunk/memcheck/mc_replace_strmem.c 2012-08-24 15:44:27 +01:00 (rev 12893)
@@ -96,6 +96,7 @@
20340 STRSPN
20350 STRCASESTR
20360 MEMRCHR
+ 20370 WCSLEN
*/
@@ -1543,6 +1544,32 @@
#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 ---*/
/*------------------------------------------------------------*/
|