summaryrefslogtreecommitdiffstats
path: root/generic/tclExecute.c
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2005-12-18 22:41:19 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2005-12-18 22:41:19 (GMT)
commit6947dd1dec4d0417fddeeefed65c0ae6008bcf48 (patch)
tree22074b7bfa1fbed60924d323ab28a05cd4eb771d /generic/tclExecute.c
parent6649ff8b06beb9b70bad5025f41bbfaf9f14c8c4 (diff)
downloadtcl-6947dd1dec4d0417fddeeefed65c0ae6008bcf48.zip
tcl-6947dd1dec4d0417fddeeefed65c0ae6008bcf48.tar.gz
tcl-6947dd1dec4d0417fddeeefed65c0ae6008bcf48.tar.bz2
A little bit of tidying up in INST_DICT_DONE (fewer type puns, faster).
Diffstat (limited to 'generic/tclExecute.c')
-rw-r--r--generic/tclExecute.c31
1 files changed, 19 insertions, 12 deletions
diff --git a/generic/tclExecute.c b/generic/tclExecute.c
index f21a4e2..f4cc090 100644
--- a/generic/tclExecute.c
+++ b/generic/tclExecute.c
@@ -12,7 +12,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclExecute.c,v 1.223 2005/12/13 13:46:12 dkf Exp $
+ * RCS: @(#) $Id: tclExecute.c,v 1.224 2005/12/18 22:41:19 dkf Exp $
*/
#include "tclInt.h"
@@ -5951,7 +5951,7 @@ TclExecuteByteCode(
if (statePtr == NULL || statePtr->typePtr != &dictIteratorType) {
Tcl_Panic("mis-issued dictNext!");
}
- searchPtr = (Tcl_DictSearch *) statePtr->internalRep.otherValuePtr;
+ searchPtr = (Tcl_DictSearch *) statePtr->internalRep.twoPtrValue.ptr1;
Tcl_DictObjNext(searchPtr, &keyPtr, &valuePtr, &done);
pushDictIteratorResult:
if (done) {
@@ -5975,24 +5975,31 @@ TclExecuteByteCode(
if (statePtr == NULL) {
Tcl_Panic("mis-issued dictDone!");
}
+
if (statePtr->typePtr == &dictIteratorType) {
+ /*
+ * First kill the search, and then release the reference to the
+ * dictionary that we were holding.
+ */
+
searchPtr = (Tcl_DictSearch *)
statePtr->internalRep.twoPtrValue.ptr1;
- dictPtr = (Tcl_Obj *) statePtr->internalRep.twoPtrValue.ptr2;
Tcl_DictObjDone(searchPtr);
ckfree((char *) searchPtr);
+
+ dictPtr = (Tcl_Obj *) statePtr->internalRep.twoPtrValue.ptr2;
Tcl_DecrRefCount(dictPtr);
- }
- /*
- * Set the internal variable to an empty object to signify that we
- * don't hold an iterator.
- */
+ /*
+ * Set the internal variable to an empty object to signify that we
+ * don't hold an iterator.
+ */
- Tcl_DecrRefCount(statePtr);
- TclNewObj(emptyPtr);
- compiledLocals[opnd].value.objPtr = emptyPtr;
- Tcl_IncrRefCount(emptyPtr);
+ Tcl_DecrRefCount(statePtr);
+ TclNewObj(emptyPtr);
+ compiledLocals[opnd].value.objPtr = emptyPtr;
+ Tcl_IncrRefCount(emptyPtr);
+ }
NEXT_INST_F(5, 0, 0);
}