summaryrefslogtreecommitdiffstats
path: root/generic/tclIndexObj.c
diff options
context:
space:
mode:
authorpooryorick <com.digitalsmarties@pooryorick.com>2016-10-03 16:55:56 (GMT)
committerpooryorick <com.digitalsmarties@pooryorick.com>2016-10-03 16:55:56 (GMT)
commit8826c4b5dc048432fbed200da55eef080c75b32c (patch)
tree630235c89d7d920a856d6b575a4c28ec3f917fdb /generic/tclIndexObj.c
parent79732cb7bfe403d288455d98bc70bf3c73e09e8f (diff)
parent2735ae8a8f3cd9a14778858d17f195bf54fc3303 (diff)
downloadtcl-8826c4b5dc048432fbed200da55eef080c75b32c.zip
tcl-8826c4b5dc048432fbed200da55eef080c75b32c.tar.gz
tcl-8826c4b5dc048432fbed200da55eef080c75b32c.tar.bz2
merge trunk
Diffstat (limited to 'generic/tclIndexObj.c')
-rw-r--r--generic/tclIndexObj.c34
1 files changed, 15 insertions, 19 deletions
diff --git a/generic/tclIndexObj.c b/generic/tclIndexObj.c
index 2281d22..6a3e4e3 100644
--- a/generic/tclIndexObj.c
+++ b/generic/tclIndexObj.c
@@ -114,14 +114,13 @@ Tcl_GetIndexFromObj(
int flags, /* 0 or TCL_EXACT */
int *indexPtr) /* Place to store resulting integer index. */
{
-
/*
* 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;
/*
@@ -211,13 +210,8 @@ GetIndexFromObjList(
tablePtr[objc] = NULL;
result = Tcl_GetIndexFromObjStruct(interp, objPtr, tablePtr,
- sizeof(char *), msg, flags, indexPtr);
-
- /*
- * The internal rep must be cleared since tablePtr will go away.
- */
+ sizeof(char *), msg, flags | INDEX_TEMP_TABLE, indexPtr);
- TclFreeIntRep(objPtr);
ckfree(tablePtr);
return result;
@@ -279,7 +273,7 @@ Tcl_GetIndexFromObjStruct(
* See if there is a valid cached result from a previous lookup.
*/
- 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;
@@ -340,17 +334,19 @@ Tcl_GetIndexFromObjStruct(
* operation.
*/
- if (objPtr->typePtr == &indexType) {
- indexRep = objPtr->internalRep.twoPtrValue.ptr1;
- } else {
- TclFreeIntRep(objPtr);
- indexRep = ckalloc(sizeof(IndexRep));
- objPtr->internalRep.twoPtrValue.ptr1 = indexRep;
- objPtr->typePtr = &indexType;
+ 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;
}
- indexRep->tablePtr = (void *) tablePtr;
- indexRep->offset = offset;
- indexRep->index = index;
*indexPtr = index;
return TCL_OK;