summaryrefslogtreecommitdiffstats
path: root/generic/tclParse.c
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2007-03-21 18:02:49 (GMT)
committerdgp <dgp@users.sourceforge.net>2007-03-21 18:02:49 (GMT)
commit1daf7b251b3f3c433644a0298c902c1c3032aa4d (patch)
tree15313c19062f14adf25226dab2cc03675bf43831 /generic/tclParse.c
parent02f9ee42d9908ad9e6c31c5c43aec3c3c65b3390 (diff)
downloadtcl-1daf7b251b3f3c433644a0298c902c1c3032aa4d.zip
tcl-1daf7b251b3f3c433644a0298c902c1c3032aa4d.tar.gz
tcl-1daf7b251b3f3c433644a0298c902c1c3032aa4d.tar.bz2
* generic/tclExecute.c: More ckalloc -> ckrealloc conversions.
* generic/tclLiteral.c: * generic/tclNamesp.c: * generic/tclParse.c: * generic/tclPreserve.c: * generic/tclStringObj.c: * generic/tclUtil.c:
Diffstat (limited to 'generic/tclParse.c')
-rw-r--r--generic/tclParse.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/generic/tclParse.c b/generic/tclParse.c
index 07b88c6..51e0306 100644
--- a/generic/tclParse.c
+++ b/generic/tclParse.c
@@ -12,7 +12,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclParse.c,v 1.49 2006/11/28 22:20:29 andreas_kupries Exp $
+ * RCS: @(#) $Id: tclParse.c,v 1.50 2007/03/21 18:02:51 dgp Exp $
*/
#include "tclInt.h"
@@ -1181,17 +1181,18 @@ TclExpandTokenArray(
Tcl_Parse *parsePtr) /* Parse structure whose token space has
* overflowed. */
{
- int newCount;
- Tcl_Token *newPtr;
+ int newCount = parsePtr->tokensAvailable*2;
- newCount = parsePtr->tokensAvailable*2;
- newPtr = (Tcl_Token *) ckalloc((unsigned) (newCount * sizeof(Tcl_Token)));
- memcpy((VOID *) newPtr, (VOID *) parsePtr->tokenPtr,
- (size_t) (parsePtr->tokensAvailable * sizeof(Tcl_Token)));
if (parsePtr->tokenPtr != parsePtr->staticTokens) {
- ckfree((char *) parsePtr->tokenPtr);
+ parsePtr->tokenPtr = (Tcl_Token *) ckrealloc ((char *)
+ (parsePtr->tokenPtr), newCount * sizeof(Tcl_Token));
+ } else {
+ Tcl_Token *newPtr = (Tcl_Token *) ckalloc(
+ newCount * sizeof(Tcl_Token));
+ memcpy(newPtr, parsePtr->tokenPtr,
+ (size_t) (parsePtr->tokensAvailable * sizeof(Tcl_Token)));
+ parsePtr->tokenPtr = newPtr;
}
- parsePtr->tokenPtr = newPtr;
parsePtr->tokensAvailable = newCount;
}