summaryrefslogtreecommitdiffstats
path: root/generic/tclLiteral.c
diff options
context:
space:
mode:
authordkf <dkf@noemail.net>2011-10-15 15:57:08 (GMT)
committerdkf <dkf@noemail.net>2011-10-15 15:57:08 (GMT)
commit6accf32ed72521b975a71d615901a6a4c5e375e7 (patch)
treeaba5b2a2307e32dbad5b1a6a7ac131837fc5b3b3 /generic/tclLiteral.c
parent85821de107e9b145bde06df339fc516176315165 (diff)
downloadtcl-6accf32ed72521b975a71d615901a6a4c5e375e7.zip
tcl-6accf32ed72521b975a71d615901a6a4c5e375e7.tar.gz
tcl-6accf32ed72521b975a71d615901a6a4c5e375e7.tar.bz2
Commit of patch relating to interp resolvers
FossilOrigin-Name: 5ba2c5ac72bc06ed0e883e0102a9e14b098c128c
Diffstat (limited to 'generic/tclLiteral.c')
-rw-r--r--generic/tclLiteral.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/generic/tclLiteral.c b/generic/tclLiteral.c
index 3a9f8e1..441ea91 100644
--- a/generic/tclLiteral.c
+++ b/generic/tclLiteral.c
@@ -936,6 +936,46 @@ RebuildLiteralTable(
}
}
+/*
+ *----------------------------------------------------------------------
+ *
+ * TclInvalidateCmdLiteral --
+ *
+ * Invalidate a command literal entry, if present in the literal hash
+ * tables, by resetting its internal representation. This invalidation
+ * leaves it in the literal tables and in existing literal arrays. As a
+ * result, existing references continue to work but we force a fresh
+ * command look-up upon the next use (see, in particular,
+ * TclSetCmdNameObj()).
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Resets the internal representation of the CmdName Tcl_Obj
+ * using TclFreeIntRep().
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TclInvalidateCmdLiteral(
+ Tcl_Interp *interp, /* Interpreter for which to invalidate a
+ * command literal. */
+ const char *name, /* Points to the start of the cmd literal
+ * name. */
+ Namespace *nsPtr) /* The namespace for which to lookup and
+ * invalidate a cmd literal. */
+{
+ Interp *iPtr = (Interp *) interp;
+ Tcl_Obj *literalObjPtr = TclCreateLiteral(iPtr, (char *) name,
+ strlen(name), -1, NULL, nsPtr, 0, NULL);
+
+ if (literalObjPtr != NULL && literalObjPtr->typePtr == &tclCmdNameType) {
+ TclFreeIntRep(literalObjPtr);
+ }
+}
+
#ifdef TCL_COMPILE_STATS
/*
*----------------------------------------------------------------------