summaryrefslogtreecommitdiffstats
path: root/generic/tclStringObj.c
diff options
context:
space:
mode:
authorKevin B Kenny <kennykb@acm.org>2010-10-20 01:50:18 (GMT)
committerKevin B Kenny <kennykb@acm.org>2010-10-20 01:50:18 (GMT)
commit7ef903af6d95a38ef6c6a3236bd637fe9a9c29a0 (patch)
tree012aca108d2e4e279dd830e7c202ea1add3fa5aa /generic/tclStringObj.c
parentab1be3cbc8f840d7d2eb235f86051e816d188187 (diff)
downloadtcl-7ef903af6d95a38ef6c6a3236bd637fe9a9c29a0.zip
tcl-7ef903af6d95a38ef6c6a3236bd637fe9a9c29a0.tar.gz
tcl-7ef903af6d95a38ef6c6a3236bd637fe9a9c29a0.tar.bz2
merge
Diffstat (limited to 'generic/tclStringObj.c')
-rw-r--r--generic/tclStringObj.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c
index 9e2e3aa..146f456 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.137 2010/04/30 20:52:51 dgp Exp $ */
+ * RCS: @(#) $Id: tclStringObj.c,v 1.137.2.1 2010/10/20 01:50:19 kennykb Exp $ */
#include "tclInt.h"
#include "tommath.h"
@@ -1228,13 +1228,23 @@ Tcl_AppendObjToObj(
const char *bytes;
/*
+ * Special case: second object is standard-empty is fast case. We know
+ * that appending nothing to anything leaves that starting anything...
+ */
+
+ if (appendObjPtr->bytes == tclEmptyStringRep) {
+ return;
+ }
+
+ /*
* Handle append of one bytearray object to another as a special case.
* Note that we only do this when the objects don't have string reps; if
* it did, then appending the byte arrays together could well lose
* information; this is a special-case optimization only.
*/
- if (TclIsPureByteArray(objPtr) && TclIsPureByteArray(appendObjPtr)) {
+ if ((TclIsPureByteArray(objPtr) || objPtr->bytes == tclEmptyStringRep)
+ && TclIsPureByteArray(appendObjPtr)) {
unsigned char *bytesSrc;
int lengthSrc, lengthTotal;