summaryrefslogtreecommitdiffstats
path: root/generic/tclVar.c
diff options
context:
space:
mode:
authorredman <redman>1999-07-22 21:50:53 (GMT)
committerredman <redman>1999-07-22 21:50:53 (GMT)
commit56b77d9d6c418f3dee04f0b31834ad76e69e11dd (patch)
treed6278f0ac3e8f40fdef3bbed06f35b3868fbb00f /generic/tclVar.c
parent41b1b6389d0f6a7a65410e66d85f909e6f855148 (diff)
downloadtcl-56b77d9d6c418f3dee04f0b31834ad76e69e11dd.zip
tcl-56b77d9d6c418f3dee04f0b31834ad76e69e11dd.tar.gz
tcl-56b77d9d6c418f3dee04f0b31834ad76e69e11dd.tar.bz2
* Changed version to 8.2b2.
* win/tclWinPort.h: Block out include of sys/*.h in order to build extensions with MetroWerks compiler for Win32. [Bug: 2385] * generic/tclCmdMZ.c: * generic/tclIO.c: Fix ANSI-style prototypes based on patch from Ulrich Ring. [Bug: 2391] * unix/Makefile.in: Need to make install-sh executable before calling (with chmod +x). [Bug: 2413] * tests/var.test: * generic/tclVar.c: Fixed bug that caused a seg. fault when using "array set a(b) {}", which is a bad array name anyway. Now the "array set" command will return an error in this case. Added test case and fixed existing test. [Bug: 2427]
Diffstat (limited to 'generic/tclVar.c')
-rw-r--r--generic/tclVar.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/generic/tclVar.c b/generic/tclVar.c
index 0618012..2dc867d 100644
--- a/generic/tclVar.c
+++ b/generic/tclVar.c
@@ -14,7 +14,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.10 1999/06/17 00:20:55 hershey Exp $
+ * RCS: @(#) $Id: tclVar.c,v 1.11 1999/07/22 21:50:54 redman Exp $
*/
#include "tclInt.h"
@@ -3198,9 +3198,23 @@ TclArraySet(interp, arrayNameObj, arrayElemObj)
Var *varPtr, *arrayPtr;
Tcl_Obj **elemPtrs;
int result, elemLen, i;
- char *varName;
+ char *varName, *p;
varName = TclGetString(arrayNameObj);
+ for (p = varName; *p ; p++) {
+ if (*p == '(') {
+ do {
+ p++;
+ } while (*p != '\0');
+ p--;
+ if (*p == ')') {
+ VarErrMsg(interp, varName, NULL, "set", needArray);
+ return TCL_ERROR;
+ }
+ break;
+ }
+ }
+
varPtr = TclLookupVar(interp, varName, (char *) NULL, /*flags*/ 0,
/*msg*/ 0, /*createPart1*/ 0, /*createPart2*/ 0, &arrayPtr);
@@ -3257,6 +3271,7 @@ TclArraySet(interp, arrayNameObj, arrayElemObj)
varPtr = TclLookupVar(interp, varName, (char *) NULL, 0, 0,
/*createPart1*/ 1, /*createPart2*/ 0, &arrayPtr);
+
}
TclSetVarArray(varPtr);
TclClearVarUndefined(varPtr);