Change VG_(strncpy_safely) to use VG_(strncpy) to get the same padding
behaviour.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14186 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/m_debuginfo/debuginfo.c b/coregrind/m_debuginfo/debuginfo.c
index 85d3ca8..99157b2 100644
--- a/coregrind/m_debuginfo/debuginfo.c
+++ b/coregrind/m_debuginfo/debuginfo.c
@@ -1870,7 +1870,6 @@
&& 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;
}
}
diff --git a/coregrind/m_libcbase.c b/coregrind/m_libcbase.c
index 56a7039..97af7c7 100644
--- a/coregrind/m_libcbase.c
+++ b/coregrind/m_libcbase.c
@@ -304,14 +304,8 @@
{
libcbase_assert(ndest > 0);
- SizeT i = 0;
- while (True) {
- dest[i] = 0;
- if (src[i] == 0) return;
- if (i >= ndest-1) return;
- dest[i] = src[i];
- i++;
- }
+ VG_(strncpy)(dest, src, ndest);
+ dest[ndest - 1] = '\0';
}
HChar* VG_(strncpy) ( HChar* dest, const HChar* src, SizeT ndest )