]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Back out r14186 as it was identified to have caused a performance regression.
authorFlorian Krohm <florian@eich-krohm.de>
Tue, 29 Jul 2014 08:46:15 +0000 (08:46 +0000)
committerFlorian Krohm <florian@eich-krohm.de>
Tue, 29 Jul 2014 08:46:15 +0000 (08:46 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14201

coregrind/m_debuginfo/debuginfo.c
coregrind/m_libcbase.c

index 333b8c57e3686a45c100e3986b95a49f951eff97..02a2139178db063dd8801ef03a1a7330d6207bba 100644 (file)
@@ -1870,6 +1870,7 @@ Bool VG_(get_objname) ( Addr a, HChar* buf, Int nbuf )
           && di->text_avma <= a 
           && a < di->text_avma + di->text_size) {
          VG_(strncpy_safely)(buf, di->fsm.filename, nbuf);
+         buf[nbuf-1] = 0;
          return True;
       }
    }
index a84eb34aaf1442d1970f52415e6543806f3c8212..abacd712d6f9fc2a66c1706f6bc2b32598d81de3 100644 (file)
@@ -304,8 +304,14 @@ void VG_(strncpy_safely) ( HChar* dest, const HChar* src, SizeT ndest )
 {
    libcbase_assert(ndest > 0);
 
-   VG_(strncpy)(dest, src, ndest);
-   dest[ndest - 1] = '\0';
+   SizeT i = 0;
+   while (True) {
+      dest[i] = 0;
+      if (src[i] == 0) return;
+      if (i >= ndest-1) return;
+      dest[i] = src[i];
+      i++;
+   }
 }
 
 HChar* VG_(strncpy) ( HChar* dest, const HChar* src, SizeT ndest )