diff options
author | Miguel Sofer <miguel.sofer@gmail.com> | 2002-07-17 20:42:26 (GMT) |
---|---|---|
committer | Miguel Sofer <miguel.sofer@gmail.com> | 2002-07-17 20:42:26 (GMT) |
commit | 374a47e9cdaed1cb9a3c4d2fb4d82bf87bcfcddd (patch) | |
tree | 9ada26f5b375c55f3433d23f72df21c88270fe5c | |
parent | b6f6d97e727f10bb363e7951b3cb80bbfac6296a (diff) | |
download | tcl-374a47e9cdaed1cb9a3c4d2fb4d82bf87bcfcddd.zip tcl-374a47e9cdaed1cb9a3c4d2fb4d82bf87bcfcddd.tar.gz tcl-374a47e9cdaed1cb9a3c4d2fb4d82bf87bcfcddd.tar.bz2 |
* generic/tclVar.c (DupParsedVarName): nasty bug fixed
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | generic/tclVar.c | 13 |
2 files changed, 12 insertions, 6 deletions
@@ -1,5 +1,10 @@ 2002-07-17 Miguel Sofer <msofer@users.sourceforge.net> + * generic/tclVar.c (DupParsedVarName): nasty bug fixed, reported + by Vince Darley. + +2002-07-17 Miguel Sofer <msofer@users.sourceforge.net> + * generic/tclVar.c (TclPtrIncrVar): missing CONST in declarations, inconsistent with tclInt.h. Thanks to Vince Darley for reporting, boo to gcc for not complaining. diff --git a/generic/tclVar.c b/generic/tclVar.c index 2392961..cf45c5c 100644 --- a/generic/tclVar.c +++ b/generic/tclVar.c @@ -15,7 +15,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclVar.c,v 1.59 2002/07/17 20:27:34 msofer Exp $ + * RCS: @(#) $Id: tclVar.c,v 1.60 2002/07/17 20:42:27 msofer Exp $ */ #include "tclInt.h" @@ -5075,14 +5075,15 @@ DupParsedVarName(srcPtr, dupPtr) if (arrayPtr != NULL) { Tcl_IncrRefCount(arrayPtr); + elemLen = strlen(elem); + elemCopy = ckalloc(elemLen+1); + memcpy(elemCopy, elem, elemLen); + *(elemCopy + elemLen) = '\0'; + elem = elemCopy; } - elemLen = strlen(elem); - elemCopy = ckalloc(elemLen+1); - memcpy(elemCopy, elem, elemLen); - *(elemCopy + elemLen) = '\0'; dupPtr->internalRep.twoPtrValue.ptr1 = (VOID *) arrayPtr; - dupPtr->internalRep.twoPtrValue.ptr2 = (VOID *) elemCopy; + dupPtr->internalRep.twoPtrValue.ptr2 = (VOID *) elem; dupPtr->typePtr = &tclParsedVarNameType; } |