diff options
author | hobbs <hobbs> | 2001-06-04 01:25:04 (GMT) |
---|---|---|
committer | hobbs <hobbs> | 2001-06-04 01:25:04 (GMT) |
commit | ea19d9dca7dada8b52673be131ea55726584ff5c (patch) | |
tree | be3fbca8ee0b0bf21ce8ac60e972a3fa5b1f81b1 | |
parent | baf3d8356bd1bf4d2aea98685aac57ce93384251 (diff) | |
download | tcl-ea19d9dca7dada8b52673be131ea55726584ff5c.zip tcl-ea19d9dca7dada8b52673be131ea55726584ff5c.tar.gz tcl-ea19d9dca7dada8b52673be131ea55726584ff5c.tar.bz2 |
* generic/tclUtil.c (Tcl_DStringAppendElement): patch to save an
extra strlen call. [Bug #428572]
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | generic/tclUtil.c | 10 |
2 files changed, 11 insertions, 4 deletions
@@ -1,3 +1,8 @@ +2001-06-03 Jeff Hobbs <jeffh@ActiveState.com> + + * generic/tclUtil.c (Tcl_DStringAppendElement): patch to save an + extra strlen call. [Bug #428572] + 2001-05-30 Donal K. Fellows <fellowsd@cs.man.ac.uk> * generic/tclExecute.c (TclExecuteByteCode): Added two casts to diff --git a/generic/tclUtil.c b/generic/tclUtil.c index 8a2aa94..bd75075 100644 --- a/generic/tclUtil.c +++ b/generic/tclUtil.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclUtil.c,v 1.18 2000/05/08 21:59:59 hobbs Exp $ + * RCS: @(#) $Id: tclUtil.c,v 1.19 2001/06/04 01:25:04 hobbs Exp $ */ #include "tclInt.h" @@ -1450,10 +1450,12 @@ Tcl_DStringAppendElement(dsPtr, string) CONST char *string; /* String to append. Must be * null-terminated. */ { - int newSize, flags; + int newSize, flags, strSize; char *dst; - newSize = Tcl_ScanElement(string, &flags) + dsPtr->length + 1; + strSize = ((string == NULL) ? 0 : strlen(string)); + newSize = Tcl_ScanCountedElement(string, strSize, &flags) + + dsPtr->length + 1; /* * Allocate a larger buffer for the string if the current one isn't @@ -1490,7 +1492,7 @@ Tcl_DStringAppendElement(dsPtr, string) dst++; dsPtr->length++; } - dsPtr->length += Tcl_ConvertElement(string, dst, flags); + dsPtr->length += Tcl_ConvertCountedElement(string, strSize, dst, flags); return dsPtr->string; } |