diff options
author | oharboe <oharboe> | 2009-08-16 11:15:52 +0000 |
---|---|---|
committer | Steve Bennett <steveb@workware.net.au> | 2010-10-15 10:59:38 +1000 |
commit | ebeb827b390fc16a336075602b70bb195f966430 (patch) | |
tree | deee53cf872df99c31ae34c9bef8d6867272cd8e /jim.c | |
parent | c1a208fac007a3219d6788aa8892550b497af074 (diff) | |
download | jimtcl-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.c | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -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; |