diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2023-10-06 09:40:23 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2023-10-06 09:40:23 (GMT) |
commit | 70a5197ec55104e14340d25077ffc21e7090d7f2 (patch) | |
tree | c6a3e614e7efc4a0237bd1fea2864439884f2107 /generic | |
parent | defed3ccfb86cc203dac761230b36ea1c039aa1f (diff) | |
download | tcl-70a5197ec55104e14340d25077ffc21e7090d7f2.zip tcl-70a5197ec55104e14340d25077ffc21e7090d7f2.tar.gz tcl-70a5197ec55104e14340d25077ffc21e7090d7f2.tar.bz2 |
Even better: Remove TclInvokeObjectCommand completely: it isn't supposed to be called by anyone
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tclBasic.c | 74 |
1 files changed, 4 insertions, 70 deletions
diff --git a/generic/tclBasic.c b/generic/tclBasic.c index f46c2bf..1c1556f 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -213,7 +213,6 @@ static void MathFuncWrongNumArgs(Tcl_Interp *interp, int expected, static Tcl_NRPostProc NRCoroutineCallerCallback; static Tcl_NRPostProc NRCoroutineExitCallback; static Tcl_NRPostProc NRCommand; -static Tcl_CmdProc InvokeObjectCommand; static void ProcessUnexpectedResult(Tcl_Interp *interp, int returnCode); @@ -1072,8 +1071,8 @@ Tcl_CreateInterp(void) * but no Tcl_ObjCmdProc, set the Tcl_ObjCmdProc to * InvokeStringCommand. This is an object-based wrapper function that * extracts strings, calls the string function, and creates an object for - * the result. Similarly, if a command has a Tcl_ObjCmdProc but no - * Tcl_CmdProc, set the Tcl_CmdProc to InvokeObjectCommand. + * the result. If a command has a Tcl_ObjCmdProc but no + * Tcl_CmdProc, set the Tcl_CmdProc to NULL. */ for (cmdInfoPtr = builtInCmds; cmdInfoPtr->name != NULL; cmdInfoPtr++) { @@ -1092,7 +1091,7 @@ Tcl_CreateInterp(void) cmdPtr->refCount = 1; cmdPtr->cmdEpoch = 0; cmdPtr->compileProc = cmdInfoPtr->compileProc; - cmdPtr->proc = InvokeObjectCommand; + cmdPtr->proc = NULL; cmdPtr->clientData = cmdPtr; cmdPtr->objProc = cmdInfoPtr->objProc; cmdPtr->objClientData = NULL; @@ -2912,7 +2911,7 @@ TclCreateObjCommandInNs( cmdPtr->compileProc = NULL; cmdPtr->objProc = proc; cmdPtr->objClientData = clientData; - cmdPtr->proc = InvokeObjectCommand; + cmdPtr->proc = NULL; cmdPtr->clientData = cmdPtr; cmdPtr->deleteProc = deleteProc; cmdPtr->deleteData = clientData; @@ -3001,71 +3000,6 @@ InvokeStringCommand( /* *---------------------------------------------------------------------- * - * InvokeObjectCommand -- - * - * "Wrapper" Tcl_CmdProc used to call an existing object-based - * Tcl_ObjCmdProc if no string-based function exists for a command. A - * pointer to this function is stored as the Tcl_CmdProc in a Command - * structure. It simply turns around and calls the object Tcl_ObjCmdProc - * in the Command structure. - * - * Results: - * A standard Tcl result value. - * - * Side effects: - * Besides those side effects of the called Tcl_ObjCmdProc, - * InvokeObjectCommand allocates and frees storage. - * - *---------------------------------------------------------------------- - */ - -int -InvokeObjectCommand( - void *clientData, /* Points to command's Command structure. */ - Tcl_Interp *interp, /* Current interpreter. */ - int argc, /* Number of arguments. */ - const char **argv) /* Argument strings. */ -{ - Command *cmdPtr = ( Command *) clientData; - Tcl_Obj *objPtr; - int i, length, result; - Tcl_Obj **objv = (Tcl_Obj **) - TclStackAlloc(interp, (argc * sizeof(Tcl_Obj *))); - - for (i = 0; i < argc; i++) { - length = strlen(argv[i]); - TclNewStringObj(objPtr, argv[i], length); - Tcl_IncrRefCount(objPtr); - objv[i] = objPtr; - } - - /* - * Invoke the command's object-based Tcl_ObjCmdProc. - */ - - if (cmdPtr->objProc != NULL) { - result = cmdPtr->objProc(cmdPtr->objClientData, interp, argc, objv); - } else { - result = Tcl_NRCallObjProc(interp, cmdPtr->nreProc, - cmdPtr->objClientData, argc, objv); - } - - /* - * Decrement the ref counts for the argument objects created above, then - * free the objv array if malloc'ed storage was used. - */ - - for (i = 0; i < argc; i++) { - objPtr = objv[i]; - Tcl_DecrRefCount(objPtr); - } - TclStackFree(interp, objv); - return result; -} - -/* - *---------------------------------------------------------------------- - * * TclRenameCommand -- * * Called to give an existing Tcl command a different name. Both the old |