summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2012-02-09 15:23:09 (GMT)
committerdgp <dgp@users.sourceforge.net>2012-02-09 15:23:09 (GMT)
commit585e9d3a4bed8f40ed559193675115a240552c2d (patch)
treef5546f1b21e0ee576ecfd76cf8d5202628dce41c
parentc24d7161999195800c8c642c949d60bf0fbd0fe7 (diff)
parent1282ebeb8db26665851fd4aad9c31e0d2e7bd7e0 (diff)
downloadtcl-585e9d3a4bed8f40ed559193675115a240552c2d.zip
tcl-585e9d3a4bed8f40ed559193675115a240552c2d.tar.gz
tcl-585e9d3a4bed8f40ed559193675115a240552c2d.tar.bz2
Converted the memcpy() calls in append operations to memmove() calls.
This adds safety in the case of overlapping copies, and improves performance on some benchmarks.
-rw-r--r--ChangeLog6
-rw-r--r--generic/tclStringObj.c4
2 files changed, 8 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index a21cc5a..386639a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2012-02-09 Don Porter <dgp@users.sourceforge.net>
+
+ * generic/tclStringObj.c: Converted the memcpy() calls in
+ append operations to memmove() calls. This adds safety in the case
+ of overlapping copies, and improves performance on some benchmarks.
+
2012-02-06 Don Porter <dgp@users.sourceforge.net>
* generic/tclEnsemble.c: [Bug 3485022] TclCompileEnsemble() avoid
diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c
index d721c47..04cf4ee 100644
--- a/generic/tclStringObj.c
+++ b/generic/tclStringObj.c
@@ -1437,7 +1437,7 @@ AppendUnicodeToUnicodeRep(
* trailing null.
*/
- memcpy(stringPtr->unicode + stringPtr->numChars, unicode,
+ memmove(stringPtr->unicode + stringPtr->numChars, unicode,
appendNumChars * sizeof(Tcl_UniChar));
stringPtr->unicode[numChars] = 0;
stringPtr->numChars = numChars;
@@ -1605,7 +1605,7 @@ AppendUtfToUtfRep(
stringPtr->numChars = -1;
stringPtr->hasUnicode = 0;
- memcpy(objPtr->bytes + oldLength, bytes, numBytes);
+ memmove(objPtr->bytes + oldLength, bytes, numBytes);
objPtr->bytes[newLength] = 0;
objPtr->length = newLength;
}