summaryrefslogtreecommitdiffstats
path: root/generic/tclEnsemble.c
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2016-06-28 21:17:28 (GMT)
committerdgp <dgp@users.sourceforge.net>2016-06-28 21:17:28 (GMT)
commitedc450c53752cf92b00a45883fee2d66a2bde27c (patch)
tree15eacd2c1053ac65edb0fe6309c2a2aac14c7f9f /generic/tclEnsemble.c
parent2453f30fb9e0fd71b6fc37ef6df3385f2efaf6d5 (diff)
parent69471e1a17152088f9d8e90e684fd75e9fc99dfc (diff)
downloadtcl-edc450c53752cf92b00a45883fee2d66a2bde27c.zip
tcl-edc450c53752cf92b00a45883fee2d66a2bde27c.tar.gz
tcl-edc450c53752cf92b00a45883fee2d66a2bde27c.tar.bz2
Route all ensemble rewrite activity through a few utility routines.
Diffstat (limited to 'generic/tclEnsemble.c')
-rw-r--r--generic/tclEnsemble.c22
1 files changed, 3 insertions, 19 deletions
diff --git a/generic/tclEnsemble.c b/generic/tclEnsemble.c
index 986a553..1c91734 100644
--- a/generic/tclEnsemble.c
+++ b/generic/tclEnsemble.c
@@ -1832,7 +1832,6 @@ NsEnsembleImplementationCmdNR(
Tcl_Obj *copyPtr; /* The actual list of words to dispatch to.
* Will be freed by the dispatch engine. */
int prefixObjc, copyObjc;
- Interp *iPtr = (Interp *) interp;
/*
* Get the prefix that we're rewriting to. To do this we need to
@@ -1876,25 +1875,10 @@ NsEnsembleImplementationCmdNR(
* count both as inserted and removed arguments.
*/
- if (iPtr->ensembleRewrite.sourceObjs == NULL) {
- iPtr->ensembleRewrite.sourceObjs = objv;
- iPtr->ensembleRewrite.numRemovedObjs =
- 2 + ensemblePtr->numParameters;
- iPtr->ensembleRewrite.numInsertedObjs =
- prefixObjc + ensemblePtr->numParameters;
+ if (TclInitRewriteEnsemble(interp, 2 + ensemblePtr->numParameters,
+ prefixObjc + ensemblePtr->numParameters, objv)) {
TclNRAddCallback(interp, TclClearRootEnsemble, NULL, NULL, NULL,
NULL);
- } else {
- register int ni = 2 + ensemblePtr->numParameters
- - iPtr->ensembleRewrite.numInsertedObjs;
- /* Position in objv of new front of insertion
- * relative to old one. */
- if (ni > 0) {
- iPtr->ensembleRewrite.numRemovedObjs += ni;
- iPtr->ensembleRewrite.numInsertedObjs += prefixObjc-1;
- } else {
- iPtr->ensembleRewrite.numInsertedObjs += prefixObjc-2;
- }
}
/*
@@ -2013,7 +1997,7 @@ TclInitRewriteEnsemble(
if (numIns < numRemoved) {
iPtr->ensembleRewrite.numRemovedObjs += numRemoved - numIns;
- iPtr->ensembleRewrite.numInsertedObjs += numInserted - 1;
+ iPtr->ensembleRewrite.numInsertedObjs = numInserted;
} else {
iPtr->ensembleRewrite.numInsertedObjs += numInserted - numRemoved;
}