.
Index: generic/tclHistory.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclHistory.c,v
retrieving revision 1.8
diff -u -r1.8 tclHistory.c
--- generic/tclHistory.c 18 Oct 2005 14:34:41 -0000 1.8
+++ generic/tclHistory.c 30 Nov 2005 02:35:29 -0000
@@ -112,29 +112,51 @@
* in global variable context instead of the
* current procedure. */
{
- int result;
+ int result, call = 0;
Tcl_Obj *list[3];
register Tcl_Obj *objPtr;
+ Tcl_CmdInfo info;
/*
- * Do recording by eval'ing a tcl history command: history add $cmd.
+ * Do not call [history] if it has been replaced by an empty proc
*/
- list[0] = Tcl_NewStringObj("history", -1);
- list[1] = Tcl_NewStringObj("add", -1);
- list[2] = cmdPtr;
-
- objPtr = Tcl_NewListObj(3, list);
- Tcl_IncrRefCount(objPtr);
- (void) Tcl_EvalObjEx(interp, objPtr, TCL_EVAL_GLOBAL);
- Tcl_DecrRefCount(objPtr);
+ result = Tcl_GetCommandInfo(interp, "history", &info);
- /*
- * One possible failure mode above: exceeding a resource limit.
- */
+ if (result) {
+ if (info.objProc != TclObjInterpProc) {
+ call = 1;
+ } else {
+ Proc *procPtr = (Proc *)(info.objClientData);
+
+ if (procPtr->cmdPtr->compileProc != TclCompileNoOp) {
+ call = 1;
+ }
+ }
+ }
+
+ if (call) {
- if (Tcl_LimitExceeded(interp)) {
- return TCL_ERROR;
+ /*
+ * Do recording by eval'ing a tcl history command: history add $cmd.
+ */
+
+ list[0] = Tcl_NewStringObj("history", -1);
+ list[1] = Tcl_NewStringObj("add", -1);
+ list[2] = cmdPtr;
+
+ objPtr = Tcl_NewListObj(3, list);
+ Tcl_IncrRefCount(objPtr);
+ (void) Tcl_EvalObjEx(interp, objPtr, TCL_EVAL_GLOBAL);
+ Tcl_DecrRefCount(objPtr);
+
+ /*
+ * One possible failure mode above: exceeding a resource limit.
+ */
+
+ if (Tcl_LimitExceeded(interp)) {
+ return TCL_ERROR;
+ }
}
/*
Index: generic/tclInt.h
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclInt.h,v
retrieving revision 1.260
diff -u -r1.260 tclInt.h
--- generic/tclInt.h 29 Nov 2005 22:50:58 -0000 1.260
+++ generic/tclInt.h 30 Nov 2005 02:35:31 -0000
@@ -2529,6 +2529,8 @@
Tcl_Parse *parsePtr, struct CompileEnv *envPtr);
MODULE_SCOPE int TclCompileLsetCmd(Tcl_Interp* interp,
Tcl_Parse* parsePtr, struct CompileEnv* envPtr);
+MODULE_SCOPE int TclCompileNoOp(Tcl_Interp *interp, Tcl_Parse *parsePtr,
+ struct CompileEnv *envPtr);
MODULE_SCOPE int TclCompileRegexpCmd(Tcl_Interp* interp,
Tcl_Parse* parsePtr, struct CompileEnv* envPtr);
MODULE_SCOPE int TclCompileReturnCmd(Tcl_Interp *interp,
Index: generic/tclProc.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclProc.c,v
retrieving revision 1.82
diff -u -r1.82 tclProc.c
--- generic/tclProc.c 2 Nov 2005 00:55:06 -0000 1.82
+++ generic/tclProc.c 30 Nov 2005 02:35:32 -0000
@@ -24,8 +24,6 @@
static void ProcBodyFree(Tcl_Obj *objPtr);
static int ProcessProcResultCode(Tcl_Interp *interp,
char *procName, int nameLen, int returnCode);
-static int TclCompileNoOp(Tcl_Interp *interp, Tcl_Parse *parsePtr,
- struct CompileEnv *envPtr);
static void InitCompiledLocals(Tcl_Interp *interp,
ByteCode *codePtr, CompiledLocal *localPtr,
Var *varPtr, Namespace *nsPtr);
@@ -1838,7 +1836,7 @@
*----------------------------------------------------------------------
*/
-static int
+int
TclCompileNoOp(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command