Intercept and replace calls to calls to strnlen in glibc, for the
usual reasons.  Also update an expected output (lines numbers in
h_intercepts.c should be removed by the regtest system, really).

--> 3_4_BRANCH



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9060 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/exp-ptrcheck/h_intercepts.c b/exp-ptrcheck/h_intercepts.c
index 48819d4..3ae8c62 100644
--- a/exp-ptrcheck/h_intercepts.c
+++ b/exp-ptrcheck/h_intercepts.c
@@ -69,6 +69,18 @@
 
 
 
+#define STRNLEN(soname, fnname) \
+   SizeT VG_REPLACE_FUNCTION_ZU(soname,fnname) ( const char* str, SizeT n ); \
+   SizeT VG_REPLACE_FUNCTION_ZU(soname,fnname) ( const char* str, SizeT n ) \
+   { \
+      SizeT i = 0; \
+      while (i < n && str[i] != 0) i++; \
+      return i; \
+   }
+
+STRNLEN(m_libc_soname, strnlen)
+
+
 // Note that this replacement often doesn't get used because gcc inlines
 // calls to strlen() with its own built-in version.  This can be very
 // confusing if you aren't expecting it.  Other small functions in this file