summaryrefslogtreecommitdiffstats
path: root/generic/tclLiteral.c
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2011-10-15 15:57:08 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2011-10-15 15:57:08 (GMT)
commit971594ecc4d41c4f217aa38a911f6858e81ca5d0 (patch)
treeaba5b2a2307e32dbad5b1a6a7ac131837fc5b3b3 /generic/tclLiteral.c
parent17f82d2daf4b9ae646c39c2922e7d73a7671ed05 (diff)
downloadtcl-971594ecc4d41c4f217aa38a911f6858e81ca5d0.zip
tcl-971594ecc4d41c4f217aa38a911f6858e81ca5d0.tar.gz
tcl-971594ecc4d41c4f217aa38a911f6858e81ca5d0.tar.bz2
Commit of patch relating to interp resolvers
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
/*
*----------------------------------------------------------------------