summaryrefslogtreecommitdiffstats
path: root/generic/tclStringObj.c
diff options
context:
space:
mode:
authordonal.k.fellows@manchester.ac.uk <dkf>2010-04-29 15:08:03 (GMT)
committerdonal.k.fellows@manchester.ac.uk <dkf>2010-04-29 15:08:03 (GMT)
commit7edf86bb80c9a6ddbf054d0dcafda93fc0c8d284 (patch)
treec5befe02e5adfaceea2503a125a5d93d52e1f063 /generic/tclStringObj.c
parentbd3918776a63ba4842c29cd3bc20a5a5d20a8e71 (diff)
downloadtcl-7edf86bb80c9a6ddbf054d0dcafda93fc0c8d284.zip
tcl-7edf86bb80c9a6ddbf054d0dcafda93fc0c8d284.tar.gz
tcl-7edf86bb80c9a6ddbf054d0dcafda93fc0c8d284.tar.bz2
* generic/tclBinary.c (TclAppendBytesToByteArray): [Bug 2992970]: Make
* generic/tclStringObj.c (Tcl_AppendObjToObj): an append of a byte array to another into an efficent operation. The problem was the (lack of) a proper growth management strategy for the byte array.
Diffstat (limited to 'generic/tclStringObj.c')
-rw-r--r--generic/tclStringObj.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c
index e075d77..e91b8a4 100644
--- a/generic/tclStringObj.c
+++ b/generic/tclStringObj.c
@@ -33,7 +33,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclStringObj.c,v 1.135 2010/03/29 21:58:58 dgp Exp $ */
+ * RCS: @(#) $Id: tclStringObj.c,v 1.136 2010/04/29 15:08:07 dkf Exp $ */
#include "tclInt.h"
#include "tommath.h"
@@ -1235,7 +1235,7 @@ Tcl_AppendObjToObj(
*/
if (TclIsPureByteArray(objPtr) && TclIsPureByteArray(appendObjPtr)) {
- unsigned char *bytesDst, *bytesSrc;
+ unsigned char *bytesSrc;
int lengthSrc, lengthTotal;
/*
@@ -1250,9 +1250,8 @@ Tcl_AppendObjToObj(
if (((length > lengthSrc) ? length : lengthSrc) > lengthTotal) {
Tcl_Panic("overflow when calculating byte array size");
}
- bytesDst = Tcl_SetByteArrayLength(objPtr, lengthTotal);
bytesSrc = Tcl_GetByteArrayFromObj(appendObjPtr, NULL);
- memcpy(bytesDst + length, bytesSrc, lengthSrc);
+ TclAppendBytesToByteArray(objPtr, bytesSrc, (unsigned) lengthSrc);
return;
}