diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2016-07-14 08:05:35 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2016-07-14 08:05:35 (GMT) |
commit | b91a1c74a96cb667373be1fa8b3da13dc82d071d (patch) | |
tree | ed90f2f9354fb22d16f3b98d4088925e362c22c6 /generic | |
parent | 3b683df1e48d9d51f9236172e8f7c196ed20cb7b (diff) | |
download | tcl-b91a1c74a96cb667373be1fa8b3da13dc82d071d.zip tcl-b91a1c74a96cb667373be1fa8b3da13dc82d071d.tar.gz tcl-b91a1c74a96cb667373be1fa8b3da13dc82d071d.tar.bz2 |
Tidy up some references to INDEX_TEMP_TABLE.minor_change
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tclIndexObj.c | 31 |
1 files changed, 13 insertions, 18 deletions
diff --git a/generic/tclIndexObj.c b/generic/tclIndexObj.c index c6873af..6a3e4e3 100644 --- a/generic/tclIndexObj.c +++ b/generic/tclIndexObj.c @@ -114,15 +114,13 @@ Tcl_GetIndexFromObj( int flags, /* 0 or TCL_EXACT */ int *indexPtr) /* Place to store resulting integer index. */ { - if (!(flags & INDEX_TEMP_TABLE)) { - /* * See if there is a valid cached result from a previous lookup (doing the * check here saves the overhead of calling Tcl_GetIndexFromObjStruct in * the common case where the result is cached). */ - if (objPtr->typePtr == &indexType) { + if (!(flags & INDEX_TEMP_TABLE) && objPtr->typePtr == &indexType) { IndexRep *indexRep = objPtr->internalRep.twoPtrValue.ptr1; /* @@ -136,7 +134,6 @@ Tcl_GetIndexFromObj( return TCL_OK; } } - } return Tcl_GetIndexFromObjStruct(interp, objPtr, tablePtr, sizeof(char *), msg, flags, indexPtr); } @@ -276,15 +273,13 @@ Tcl_GetIndexFromObjStruct( * See if there is a valid cached result from a previous lookup. */ - if (!(flags & INDEX_TEMP_TABLE)) { - if (objPtr->typePtr == &indexType) { + if (!(flags & INDEX_TEMP_TABLE) && objPtr->typePtr == &indexType) { indexRep = objPtr->internalRep.twoPtrValue.ptr1; if (indexRep->tablePtr==tablePtr && indexRep->offset==offset) { *indexPtr = indexRep->index; return TCL_OK; } } - } /* * Lookup the value of the object in the table. Accept unique @@ -340,17 +335,17 @@ Tcl_GetIndexFromObjStruct( */ if (!(flags & INDEX_TEMP_TABLE)) { - if (objPtr->typePtr == &indexType) { - indexRep = objPtr->internalRep.twoPtrValue.ptr1; - } else { - TclFreeIntRep(objPtr); - indexRep = ckalloc(sizeof(IndexRep)); - objPtr->internalRep.twoPtrValue.ptr1 = indexRep; - objPtr->typePtr = &indexType; - } - indexRep->tablePtr = (void *) tablePtr; - indexRep->offset = offset; - indexRep->index = index; + if (objPtr->typePtr == &indexType) { + indexRep = objPtr->internalRep.twoPtrValue.ptr1; + } else { + TclFreeIntRep(objPtr); + indexRep = ckalloc(sizeof(IndexRep)); + objPtr->internalRep.twoPtrValue.ptr1 = indexRep; + objPtr->typePtr = &indexType; + } + indexRep->tablePtr = (void *) tablePtr; + indexRep->offset = offset; + indexRep->index = index; } *indexPtr = index; |