aboutsummaryrefslogtreecommitdiff
path: root/jim.c
diff options
context:
space:
mode:
authoroharboe <oharboe>2009-08-16 11:15:52 +0000
committerSteve Bennett <steveb@workware.net.au>2010-10-15 10:59:38 +1000
commitebeb827b390fc16a336075602b70bb195f966430 (patch)
treedeee53cf872df99c31ae34c9bef8d6867272cd8e /jim.c
parentc1a208fac007a3219d6788aa8892550b497af074 (diff)
downloadjimtcl-ebeb827b390fc16a336075602b70bb195f966430.zip
jimtcl-ebeb827b390fc16a336075602b70bb195f966430.tar.gz
jimtcl-ebeb827b390fc16a336075602b70bb195f966430.tar.bz2
Fix 'unset ::var' to unset a global var
It was doing nothing. Signed-off-by: Steve Bennett <steveb@workware.net.au>
Diffstat (limited to 'jim.c')
-rw-r--r--jim.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/jim.c b/jim.c
index 3227a23..3b0e207 100644
--- a/jim.c
+++ b/jim.c
@@ -3,7 +3,7 @@
* Copyright 2005 Salvatore Sanfilippo <antirez@invece.org>
* Copyright 2005 Clemens Hintze <c.hintze@gmx.net>
* Copyright 2005 patthoyts - Pat Thoyts <patthoyts@users.sf.net>
- * Copyright 2008 oharboe - Øyvind Harboe - oyvind.harboe@zylin.com
+ * Copyright 2008 oharboe - �yvind Harboe - oyvind.harboe@zylin.com
* Copyright 2008 Andrew Lunn <andrew@lunn.ch>
* Copyright 2008 Duane Ellis <openocd@duaneellis.com>
* Copyright 2008 Uwe Klein <uklein@klein-messgeraete.de>
@@ -3724,10 +3724,13 @@ int Jim_UnsetVariable(Jim_Interp *interp, Jim_Obj *nameObjPtr, int flags)
} else {
name = Jim_GetString(nameObjPtr, NULL);
if (name[0] == ':' && name[1] == ':') {
- name += 2;
+ if (Jim_DeleteHashEntry(&interp->topFramePtr->vars, name + 2) != JIM_OK) {
+ return JIM_ERR;
+ }
+ }
+ else if (Jim_DeleteHashEntry(&interp->framePtr->vars, name) != JIM_OK) {
+ return JIM_ERR;
}
- if (Jim_DeleteHashEntry(&interp->framePtr->vars, name)
- != JIM_OK) return JIM_ERR;
/* Change the callframe id, invalidating var lookup caching */
JimChangeCallFrameId(interp, interp->framePtr);
return JIM_OK;