diff options
author | oharboe <oharboe> | 2009-08-16 11:37:03 +0000 |
---|---|---|
committer | oharboe <oharboe> | 2009-08-16 11:37:03 +0000 |
commit | d0c5df9ca126ccd1dbc40f75e33b016859d0bfe6 (patch) | |
tree | c3bef8ca2e069c56c74bac589d9fbc32f1ffec44 | |
parent | 5d231b9a3cac7de53a7a4c8c6fc88ef96b26d40b (diff) | |
download | jimtcl-d0c5df9ca126ccd1dbc40f75e33b016859d0bfe6.zip jimtcl-d0c5df9ca126ccd1dbc40f75e33b016859d0bfe6.tar.gz jimtcl-d0c5df9ca126ccd1dbc40f75e33b016859d0bfe6.tar.bz2 |
2009-08-16 Steve Bennett <steveb@workware.net.au>
* jim.c/h: If an object is used in subst, then source, a crash will result
-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | jim.c | 8 | ||||
-rw-r--r-- | jim.h | 3 |
3 files changed, 9 insertions, 3 deletions
@@ -1,5 +1,6 @@ 2009-08-16 Steve Bennett <steveb@workware.net.au> + * jim.c/h: If an object is used in subst, then source, a crash will result * jimsh.c: A script exiting with 'exit 0' would not give a return code of 0 * jim.c: Make [format %c 0] work (embedded nulls) * jim-array-1.0.tcl: array unset was broken @@ -3012,6 +3012,7 @@ int SetScriptFromAny(Jim_Interp *interp, struct Jim_Obj *objPtr) script->commands = 0; script->token = NULL; script->cmdStruct = NULL; + script->substFlags = 0; script->inUse = 1; /* Try to get information about filename / line number */ if (objPtr->typePtr == &sourceObjType) { @@ -3116,12 +3117,15 @@ int SetScriptFromAny(Jim_Interp *interp, struct Jim_Obj *objPtr) Jim_FreeIntRep(interp, objPtr); Jim_SetIntRepPtr(objPtr, script); objPtr->typePtr = &scriptObjType; + return JIM_OK; } ScriptObj *Jim_GetScript(Jim_Interp *interp, Jim_Obj *objPtr) { - if (objPtr->typePtr != &scriptObjType) { + struct ScriptObj *script = Jim_GetIntRepPtr(objPtr); + + if (objPtr->typePtr != &scriptObjType || script->substFlags) { SetScriptFromAny(interp, objPtr); } return (ScriptObj*) Jim_GetIntRepPtr(objPtr); @@ -11617,7 +11621,7 @@ static int Jim_LoadCoreCommand(Jim_Interp *interp, int argc, static int Jim_SubstCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { - int i, flags = 0; + int i, flags = JIM_SUBST_FLAG; Jim_Obj *objPtr; if (argc < 2) { @@ -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> @@ -176,6 +176,7 @@ extern "C" { #define JIM_SUBST_NOVAR 1 /* don't perform variables substitutions */ #define JIM_SUBST_NOCMD 2 /* don't perform command substitutions */ #define JIM_SUBST_NOESC 4 /* don't perform escapes substitutions */ +#define JIM_SUBST_FLAG 128 /* flag to indicate that this is a real substition object */ /* Unused arguments generate annoying warnings... */ #define JIM_NOTUSED(V) ((void) V) |