[Julian, you might like to check these changes]

Fixed demangler bug -- it was relying on glibc for some functions.  This
triggered an incredibly obscure bug in my experimental skin -- memcpy() was
called within the demangler at (about?) the same time as the dynamic linker was
fiddling with the memcpy() entry, which caused one word of memory (probably
some counter in the dynamic linker) to be incremented, which my skin didn't
like.

So I removed all (AFAICT) of the demangler's dependencies on glibc.  This
required adding macros for memset, memcpy, strlen, strcmp..., to replace them
with their VG_(...) version.  The only #includes now are to .h files that are
part of Valgrind.

Also required #defining "size_t" as "Int".

Also required adding VG_(memcmp)() to vg_mylibc.c.

Also removed the "-1 == EOF" part of the compile-time test in safe-ctype.h
that checks the character set is ASCII.  This was to remove the dependency
on stdio.h.  Slightly dodgy, but should be ok I think/hope.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1436 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/vg_mylibc.c b/coregrind/vg_mylibc.c
index 7611892..3792ac2 100644
--- a/coregrind/vg_mylibc.c
+++ b/coregrind/vg_mylibc.c
@@ -964,6 +964,25 @@
    return dest;
 }
 
+Int VG_(memcmp) ( const void* s1, const void* s2, Int n )
+{
+   Int res;
+   Char a0;
+   Char b0;
+   vg_assert(n >= 0);
+
+   while (n != 0) {
+      a0 = ((Char *) s1)[0];
+      b0 = ((Char *) s2)[0];
+      s1 += 1;
+      s2 += 1;
+      res = a0 - b0;
+      if (res != 0)
+         return res;
+      n -= 1;
+   }
+   return 0;
+}
 
 Char VG_(toupper) ( Char c )
 {