summaryrefslogtreecommitdiffstats
path: root/generic/tclStringObj.c
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)
commitd867e059f4f1b530da4dcbc947ba97eea20b0143 (patch)
treef5546f1b21e0ee576ecfd76cf8d5202628dce41c /generic/tclStringObj.c
parent19b28f86f9e74c6fbcb63b86257096e2197623fc (diff)
parentdf15da28485c15bf11e1412ac5375e51f15b7ca6 (diff)
downloadtcl-d867e059f4f1b530da4dcbc947ba97eea20b0143.zip
tcl-d867e059f4f1b530da4dcbc947ba97eea20b0143.tar.gz
tcl-d867e059f4f1b530da4dcbc947ba97eea20b0143.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.
Diffstat (limited to 'generic/tclStringObj.c')
-rw-r--r--generic/tclStringObj.c4
1 files changed, 2 insertions, 2 deletions
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;
}