diff options
author | dgp <dgp@users.sourceforge.net> | 2016-07-01 19:42:38 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2016-07-01 19:42:38 (GMT) |
commit | f7aa28a9960d172ef84736f3609940c5564d5325 (patch) | |
tree | 61695be00f75d4e1e079f67f07bc482c8284de42 /generic/tclEnsemble.c | |
parent | d0f0605e49962b24f78b2274aadeeeb482a387ff (diff) | |
download | tcl-f7aa28a9960d172ef84736f3609940c5564d5325.zip tcl-f7aa28a9960d172ef84736f3609940c5564d5325.tar.gz tcl-f7aa28a9960d172ef84736f3609940c5564d5325.tar.bz2 |
The EnsembleCmdRep struct that is the internal rep for caching ensemble
dispatches and spelling corrections can now be file static.
Diffstat (limited to 'generic/tclEnsemble.c')
-rw-r--r-- | generic/tclEnsemble.c | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/generic/tclEnsemble.c b/generic/tclEnsemble.c index 75c2747..5c47ce3 100644 --- a/generic/tclEnsemble.c +++ b/generic/tclEnsemble.c @@ -76,7 +76,7 @@ enum EnsConfigOpts { * that implements it. */ -const Tcl_ObjType tclEnsembleCmdType = { +static const Tcl_ObjType ensembleCmdType = { "ensembleCommand", /* the type's name */ FreeEnsembleCmdRep, /* freeIntRepProc */ DupEnsembleCmdRep, /* dupIntRepProc */ @@ -84,6 +84,22 @@ const Tcl_ObjType tclEnsembleCmdType = { NULL /* setFromAnyProc */ }; +/* + * The internal rep for caching ensemble subcommand lookups and + * spell corrections. + */ + +typedef struct { + int epoch; /* Used to confirm when the data in this + * really structure matches up with the + * ensemble. */ + Tcl_Command token; /* Reference to the comamnd for which this + * structure is a cache of the resolution. */ + Tcl_Obj *fix; /* Corrected spelling, if needed. */ + Tcl_HashEntry *hPtr; /* Direct link to entry in the subcommand + * hash table. */ +} EnsembleCmdRep; + static inline Tcl_Obj * NewNsObj( @@ -1707,7 +1723,7 @@ NsEnsembleImplementationCmdNR( * part where we do the invocation of the subcommand. */ - if (subObj->typePtr==&tclEnsembleCmdType){ + if (subObj->typePtr==&ensembleCmdType){ EnsembleCmdRep *ensembleCmd = subObj->internalRep.twoPtrValue.ptr1; if (ensembleCmd->epoch == ensemblePtr->epoch && @@ -2366,7 +2382,7 @@ MakeCachedEnsembleCommand( { register EnsembleCmdRep *ensembleCmd; - if (objPtr->typePtr == &tclEnsembleCmdType) { + if (objPtr->typePtr == &ensembleCmdType) { ensembleCmd = objPtr->internalRep.twoPtrValue.ptr1; if (ensembleCmd->fix) { Tcl_DecrRefCount(ensembleCmd->fix); @@ -2380,7 +2396,7 @@ MakeCachedEnsembleCommand( TclFreeIntRep(objPtr); ensembleCmd = ckalloc(sizeof(EnsembleCmdRep)); objPtr->internalRep.twoPtrValue.ptr1 = ensembleCmd; - objPtr->typePtr = &tclEnsembleCmdType; + objPtr->typePtr = &ensembleCmdType; } /* @@ -2807,7 +2823,7 @@ DupEnsembleCmdRep( EnsembleCmdRep *ensembleCmd = objPtr->internalRep.twoPtrValue.ptr1; EnsembleCmdRep *ensembleCopy = ckalloc(sizeof(EnsembleCmdRep)); - copyPtr->typePtr = &tclEnsembleCmdType; + copyPtr->typePtr = &ensembleCmdType; copyPtr->internalRep.twoPtrValue.ptr1 = ensembleCopy; ensembleCopy->epoch = ensembleCmd->epoch; ensembleCopy->token = ensembleCmd->token; |