diff options
| -rw-r--r-- | generic/tclIndexObj.c | 22 | ||||
| -rw-r--r-- | generic/tclInt.h | 1 | ||||
| -rw-r--r-- | generic/tclObj.c | 6 |
3 files changed, 18 insertions, 11 deletions
diff --git a/generic/tclIndexObj.c b/generic/tclIndexObj.c index 5697fd8..3134b66 100644 --- a/generic/tclIndexObj.c +++ b/generic/tclIndexObj.c @@ -37,7 +37,7 @@ static void PrintUsage(Tcl_Interp *interp, * that can be invoked by generic object code. */ -static const Tcl_ObjType indexType = { +const Tcl_ObjType tclIndexType = { "index", /* name */ FreeIndex, /* freeIntRepProc */ DupIndex, /* dupIntRepProc */ @@ -213,7 +213,7 @@ Tcl_GetIndexFromObjStruct( */ if (objPtr && !(flags & TCL_INDEX_TEMP_TABLE)) { - irPtr = TclFetchInternalRep(objPtr, &indexType); + irPtr = TclFetchInternalRep(objPtr, &tclIndexType); if (irPtr) { indexRep = (IndexRep *)irPtr->twoPtrValue.ptr1; if ((indexRep->tablePtr == tablePtr) @@ -282,7 +282,7 @@ Tcl_GetIndexFromObjStruct( */ if (objPtr && (index != TCL_INDEX_NONE) && !(flags & TCL_INDEX_TEMP_TABLE)) { - irPtr = TclFetchInternalRep(objPtr, &indexType); + irPtr = TclFetchInternalRep(objPtr, &tclIndexType); if (irPtr) { indexRep = (IndexRep *)irPtr->twoPtrValue.ptr1; } else { @@ -290,7 +290,7 @@ Tcl_GetIndexFromObjStruct( indexRep = (IndexRep*)Tcl_Alloc(sizeof(IndexRep)); ir.twoPtrValue.ptr1 = indexRep; - Tcl_StoreInternalRep(objPtr, &indexType, &ir); + Tcl_StoreInternalRep(objPtr, &tclIndexType, &ir); } indexRep->tablePtr = (void *) tablePtr; indexRep->offset = offset; @@ -385,7 +385,7 @@ static void UpdateStringOfIndex( Tcl_Obj *objPtr) { - IndexRep *indexRep = (IndexRep *)TclFetchInternalRep(objPtr, &indexType)->twoPtrValue.ptr1; + IndexRep *indexRep = (IndexRep *)TclFetchInternalRep(objPtr, &tclIndexType)->twoPtrValue.ptr1; const char *indexStr = EXPAND_OF(indexRep); Tcl_InitStringRep(objPtr, indexStr, strlen(indexStr)); @@ -417,11 +417,11 @@ DupIndex( Tcl_ObjInternalRep ir; IndexRep *dupIndexRep = (IndexRep *)Tcl_Alloc(sizeof(IndexRep)); - memcpy(dupIndexRep, TclFetchInternalRep(srcPtr, &indexType)->twoPtrValue.ptr1, + memcpy(dupIndexRep, TclFetchInternalRep(srcPtr, &tclIndexType)->twoPtrValue.ptr1, sizeof(IndexRep)); ir.twoPtrValue.ptr1 = dupIndexRep; - Tcl_StoreInternalRep(dupPtr, &indexType, &ir); + Tcl_StoreInternalRep(dupPtr, &tclIndexType, &ir); } /* @@ -445,7 +445,7 @@ static void FreeIndex( Tcl_Obj *objPtr) { - Tcl_Free(TclFetchInternalRep(objPtr, &indexType)->twoPtrValue.ptr1); + Tcl_Free(TclFetchInternalRep(objPtr, &tclIndexType)->twoPtrValue.ptr1); objPtr->typePtr = NULL; } @@ -865,7 +865,7 @@ Tcl_WrongNumArgs( */ const Tcl_ObjInternalRep *irPtr; - if ((irPtr = TclFetchInternalRep(origObjv[i], &indexType))) { + if ((irPtr = TclFetchInternalRep(origObjv[i], &tclIndexType))) { IndexRep *indexRep = (IndexRep *)irPtr->twoPtrValue.ptr1; elementStr = EXPAND_OF(indexRep); @@ -912,7 +912,7 @@ Tcl_WrongNumArgs( */ const Tcl_ObjInternalRep *irPtr; - if ((irPtr = TclFetchInternalRep(objv[i], &indexType))) { + if ((irPtr = TclFetchInternalRep(objv[i], &tclIndexType))) { IndexRep *indexRep = (IndexRep *)irPtr->twoPtrValue.ptr1; Tcl_AppendStringsToObj(objPtr, EXPAND_OF(indexRep), NULL); @@ -1361,7 +1361,7 @@ TclGetCompletionCodeFromObj( "ok", "error", "return", "break", "continue", NULL }; - if (!TclHasInternalRep(value, &indexType) + if (!TclHasInternalRep(value, &tclIndexType) && TclGetIntFromObj(NULL, value, codePtr) == TCL_OK) { return TCL_OK; } diff --git a/generic/tclInt.h b/generic/tclInt.h index 29b19a8..d7941fb 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -3056,6 +3056,7 @@ MODULE_SCOPE const Tcl_ObjType tclBooleanType; MODULE_SCOPE const Tcl_ObjType tclByteCodeType; MODULE_SCOPE const Tcl_ObjType tclDoubleType; MODULE_SCOPE const Tcl_ObjType tclIntType; +MODULE_SCOPE const Tcl_ObjType tclIndexType; MODULE_SCOPE const Tcl_ObjType tclListType; MODULE_SCOPE const Tcl_ObjType tclDictType; MODULE_SCOPE const Tcl_ObjType tclProcBodyType; diff --git a/generic/tclObj.c b/generic/tclObj.c index 784162e..1fe667a 100644 --- a/generic/tclObj.c +++ b/generic/tclObj.c @@ -1653,12 +1653,18 @@ int SetDuplicatePureObj( * * Perhaps in the future this can be remedied and this special treatment * removed. + * + * Similar problem with the integer (0x0A vs 10), double (1e-1 vs 0.1) and + * index types ("coord" vs "coords", see bug [a34733451b]) */ if (bytes && (dupPtr->typePtr == NULL || dupPtr->typePtr->updateStringProc == NULL || useTypePtr == &tclStringType + || typePtr == &tclDoubleType + || typePtr == &tclIntType + || typePtr == &tclIndexType ) ) { if (!TclAttemptInitStringRep(dupPtr, bytes, objPtr->length)) { |
