summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorhobbs <hobbs>2001-06-04 01:25:04 (GMT)
committerhobbs <hobbs>2001-06-04 01:25:04 (GMT)
commitea19d9dca7dada8b52673be131ea55726584ff5c (patch)
treebe3fbca8ee0b0bf21ce8ac60e972a3fa5b1f81b1 /generic
parentbaf3d8356bd1bf4d2aea98685aac57ce93384251 (diff)
downloadtcl-ea19d9dca7dada8b52673be131ea55726584ff5c.zip
tcl-ea19d9dca7dada8b52673be131ea55726584ff5c.tar.gz
tcl-ea19d9dca7dada8b52673be131ea55726584ff5c.tar.bz2
* generic/tclUtil.c (Tcl_DStringAppendElement): patch to save an
extra strlen call. [Bug #428572]
Diffstat (limited to 'generic')
-rw-r--r--generic/tclUtil.c10
1 files changed, 6 insertions, 4 deletions
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;
}