Index: generic/nsfShadow.c =================================================================== diff -u -rcaba76f5ac2943f5a3dfd33550cb578132f40c80 -r92ab630ebd3c1b907e3d0fdf97cc07914245c028 --- generic/nsfShadow.c (.../nsfShadow.c) (revision caba76f5ac2943f5a3dfd33550cb578132f40c80) +++ generic/nsfShadow.c (.../nsfShadow.c) (revision 92ab630ebd3c1b907e3d0fdf97cc07914245c028) @@ -44,12 +44,16 @@ * *---------------------------------------------------------------------- */ +static int NsfReplaceCommandCleanup(Tcl_Interp *interp, NsfGlobalNames name) nonnull(1); + static int NsfReplaceCommandCleanup(Tcl_Interp *interp, NsfGlobalNames name) { Tcl_Command cmd; int result = TCL_OK; NsfShadowTclCommandInfo *ti = &RUNTIME_STATE(interp)->tclCommands[name-NSF_EXPR]; + assert(interp); + /*fprintf(stderr," cleanup for %s ti=%p in %p\n", NsfGlobalStrings[name], ti, interp);*/ cmd = Tcl_GetCommandFromObj(interp, NsfGlobalObjs[name]); if (cmd != NULL) { @@ -77,10 +81,16 @@ * *---------------------------------------------------------------------- */ +static void NsfReplaceCommandCheck(Tcl_Interp *interp, NsfGlobalNames name, Tcl_ObjCmdProc *proc) nonnull(1) nonnull(3); + static void NsfReplaceCommandCheck(Tcl_Interp *interp, NsfGlobalNames name, Tcl_ObjCmdProc *proc) { - Tcl_Command cmd; NsfShadowTclCommandInfo *ti = &RUNTIME_STATE(interp)->tclCommands[name-NSF_EXPR]; + Tcl_Command cmd; + + assert(interp); + assert(proc); + cmd = Tcl_GetCommandFromObj(interp, NsfGlobalObjs[name]); if (cmd != NULL && ti->proc && Tcl_Command_objProc(cmd) != proc) { @@ -110,13 +120,18 @@ * *---------------------------------------------------------------------- */ +static int NsfReplaceCommand(Tcl_Interp *interp, NsfGlobalNames name, + Tcl_ObjCmdProc *nsfReplacementProc, int pass) nonnull(1); + static int NsfReplaceCommand(Tcl_Interp *interp, NsfGlobalNames name, Tcl_ObjCmdProc *nsfReplacementProc, int pass) { Tcl_Command cmd; NsfShadowTclCommandInfo *ti = &RUNTIME_STATE(interp)->tclCommands[name-NSF_EXPR]; int result = TCL_OK; + assert(interp); + /*fprintf(stderr,"NsfReplaceCommand %d\n", name);*/ cmd = Tcl_GetCommandFromObj(interp, NsfGlobalObjs[name]); @@ -162,13 +177,16 @@ * *---------------------------------------------------------------------- */ -EXTERN int -NsfProcStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]); +EXTERN int NsfProcStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) + nonnull(1) nonnull(2) nonnull(4); static int Nsf_InfoBodyObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { Tcl_Command cmd; + assert(interp); + assert(objv); + if (objc != 2) { /* wrong # args, let Tcl generate the error */ return NsfCallCommand(interp, NSF_INFO_BODY, objc, objv); @@ -369,8 +387,11 @@ int NsfShadowTclCommands(Tcl_Interp *interp, NsfShadowOperations load) { int rc = TCL_OK; + assert(interp); + if (load == SHADOW_LOAD) { int initialized = (RUNTIME_STATE(interp)->tclCommands != NULL); + assert(initialized == 0); RUNTIME_STATE(interp)->tclCommands = NEW_ARRAY(NsfShadowTclCommandInfo, NSF_RENAME - NSF_EXPR + 1);