diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2010-04-29 15:08:03 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2010-04-29 15:08:03 (GMT) |
commit | b84b65f49a83dd2409278f59c82fc6c79d466819 (patch) | |
tree | c5befe02e5adfaceea2503a125a5d93d52e1f063 /generic/tclStringObj.c | |
parent | 4e1cb8f323af8a2dbf67db4528b5da18cdfbe4ca (diff) | |
download | tcl-b84b65f49a83dd2409278f59c82fc6c79d466819.zip tcl-b84b65f49a83dd2409278f59c82fc6c79d466819.tar.gz tcl-b84b65f49a83dd2409278f59c82fc6c79d466819.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.c | 7 |
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; } |