diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2019-01-28 21:47:50 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2019-01-28 21:47:50 (GMT) |
commit | e16381966055e98a93d0980a01b104ac5c15deea (patch) | |
tree | d7bac4919fd7b61a8abec91ee036080601072cea /generic | |
parent | be7f60de2674744ab5c95aee1a15a108b0d4ea74 (diff) | |
parent | af3406f86c40c78cff50cb5003b8be0eae448d54 (diff) | |
download | tcl-e16381966055e98a93d0980a01b104ac5c15deea.zip tcl-e16381966055e98a93d0980a01b104ac5c15deea.tar.gz tcl-e16381966055e98a93d0980a01b104ac5c15deea.tar.bz2 |
Merge 8.7
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tclBasic.c | 14 | ||||
-rw-r--r-- | generic/tclBinary.c | 44 | ||||
-rw-r--r-- | generic/tclClock.c | 2 | ||||
-rw-r--r-- | generic/tclCmdMZ.c | 12 | ||||
-rw-r--r-- | generic/tclCompile.h | 2 | ||||
-rw-r--r-- | generic/tclDictObj.c | 4 | ||||
-rw-r--r-- | generic/tclDisassemble.c | 6 | ||||
-rw-r--r-- | generic/tclEncoding.c | 2 | ||||
-rw-r--r-- | generic/tclEnsemble.c | 2 | ||||
-rw-r--r-- | generic/tclExecute.c | 10 | ||||
-rw-r--r-- | generic/tclIO.c | 2 | ||||
-rw-r--r-- | generic/tclIndexObj.c | 14 | ||||
-rw-r--r-- | generic/tclInt.h | 2 | ||||
-rw-r--r-- | generic/tclLink.c | 2 | ||||
-rw-r--r-- | generic/tclListObj.c | 10 | ||||
-rw-r--r-- | generic/tclNamesp.c | 2 | ||||
-rw-r--r-- | generic/tclOOCall.c | 6 | ||||
-rw-r--r-- | generic/tclObj.c | 8 | ||||
-rw-r--r-- | generic/tclPathObj.c | 22 | ||||
-rw-r--r-- | generic/tclProc.c | 8 | ||||
-rw-r--r-- | generic/tclRegexp.c | 2 | ||||
-rw-r--r-- | generic/tclScan.c | 2 | ||||
-rw-r--r-- | generic/tclUtil.c | 2 | ||||
-rw-r--r-- | generic/tclVar.c | 4 |
24 files changed, 90 insertions, 94 deletions
diff --git a/generic/tclBasic.c b/generic/tclBasic.c index 549c751..5c51291 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -6704,7 +6704,7 @@ ExprCeilFunc( code = Tcl_GetDoubleFromObj(interp, objv[1], &d); #ifdef ACCEPT_NAN if (code != TCL_OK) { - const Tcl_ObjIntRep *irPtr = Tcl_FetchIntRep(objv[1], &tclDoubleType); + const Tcl_ObjIntRep *irPtr = TclFetchIntRep(objv[1], &tclDoubleType); if (irPtr) { Tcl_SetObjResult(interp, objv[1]); @@ -6744,7 +6744,7 @@ ExprFloorFunc( code = Tcl_GetDoubleFromObj(interp, objv[1], &d); #ifdef ACCEPT_NAN if (code != TCL_OK) { - const Tcl_ObjIntRep *irPtr = Tcl_FetchIntRep(objv[1], &tclDoubleType); + const Tcl_ObjIntRep *irPtr = TclFetchIntRep(objv[1], &tclDoubleType); if (irPtr) { Tcl_SetObjResult(interp, objv[1]); @@ -6884,7 +6884,7 @@ ExprSqrtFunc( code = Tcl_GetDoubleFromObj(interp, objv[1], &d); #ifdef ACCEPT_NAN if (code != TCL_OK) { - const Tcl_ObjIntRep *irPtr = Tcl_FetchIntRep(objv[1], &tclDoubleType); + const Tcl_ObjIntRep *irPtr = TclFetchIntRep(objv[1], &tclDoubleType); if (irPtr) { Tcl_SetObjResult(interp, objv[1]); @@ -6931,7 +6931,7 @@ ExprUnaryFunc( code = Tcl_GetDoubleFromObj(interp, objv[1], &d); #ifdef ACCEPT_NAN if (code != TCL_OK) { - const Tcl_ObjIntRep *irPtr = Tcl_FetchIntRep(objv[1], &tclDoubleType); + const Tcl_ObjIntRep *irPtr = TclFetchIntRep(objv[1], &tclDoubleType); if (irPtr) { d = irPtr->doubleValue; @@ -6995,7 +6995,7 @@ ExprBinaryFunc( code = Tcl_GetDoubleFromObj(interp, objv[1], &d1); #ifdef ACCEPT_NAN if (code != TCL_OK) { - const Tcl_ObjIntRep *irPtr = Tcl_FetchIntRep(objv[1], &tclDoubleType); + const Tcl_ObjIntRep *irPtr = TclFetchIntRep(objv[1], &tclDoubleType); if (irPtr) { d1 = irPtr->doubleValue; @@ -7010,7 +7010,7 @@ ExprBinaryFunc( code = Tcl_GetDoubleFromObj(interp, objv[2], &d2); #ifdef ACCEPT_NAN if (code != TCL_OK) { - const Tcl_ObjIntRep *irPtr = Tcl_FetchIntRep(objv[1], &tclDoubleType); + const Tcl_ObjIntRep *irPtr = TclFetchIntRep(objv[1], &tclDoubleType); if (irPtr) { d2 = irPtr->doubleValue; @@ -7158,7 +7158,7 @@ ExprDoubleFunc( } if (Tcl_GetDoubleFromObj(interp, objv[1], &dResult) != TCL_OK) { #ifdef ACCEPT_NAN - if (Tcl_FetchIntRep(objv[1], &tclDoubleType)) { + if (objv[1]->typePtr == &tclDoubleType) { Tcl_SetObjResult(interp, objv[1]); return TCL_OK; } diff --git a/generic/tclBinary.c b/generic/tclBinary.c index c692b40..6760020 100644 --- a/generic/tclBinary.c +++ b/generic/tclBinary.c @@ -291,7 +291,7 @@ int TclIsPureByteArray( Tcl_Obj * objPtr) { - return (NULL != Tcl_FetchIntRep(objPtr, &properByteArrayType)); + return objPtr->typePtr == &properByteArrayType; } /* @@ -448,15 +448,15 @@ Tcl_GetByteArrayFromObj( * array of bytes in the ByteArray object. */ { ByteArray *baPtr; - const Tcl_ObjIntRep *irPtr = Tcl_FetchIntRep(objPtr, &properByteArrayType); + const Tcl_ObjIntRep *irPtr = TclFetchIntRep(objPtr, &properByteArrayType); if (irPtr == NULL) { - irPtr = Tcl_FetchIntRep(objPtr, &tclByteArrayType); + irPtr = TclFetchIntRep(objPtr, &tclByteArrayType); if (irPtr == NULL) { SetByteArrayFromAny(NULL, objPtr); - irPtr = Tcl_FetchIntRep(objPtr, &properByteArrayType); + irPtr = TclFetchIntRep(objPtr, &properByteArrayType); if (irPtr == NULL) { - irPtr = Tcl_FetchIntRep(objPtr, &tclByteArrayType); + irPtr = TclFetchIntRep(objPtr, &tclByteArrayType); } } } @@ -502,14 +502,14 @@ Tcl_SetByteArrayLength( Tcl_Panic("%s called with shared object", "Tcl_SetByteArrayLength"); } - irPtr = Tcl_FetchIntRep(objPtr, &properByteArrayType); + irPtr = TclFetchIntRep(objPtr, &properByteArrayType); if (irPtr == NULL) { - irPtr = Tcl_FetchIntRep(objPtr, &tclByteArrayType); + irPtr = TclFetchIntRep(objPtr, &tclByteArrayType); if (irPtr == NULL) { SetByteArrayFromAny(NULL, objPtr); - irPtr = Tcl_FetchIntRep(objPtr, &properByteArrayType); + irPtr = TclFetchIntRep(objPtr, &properByteArrayType); if (irPtr == NULL) { - irPtr = Tcl_FetchIntRep(objPtr, &tclByteArrayType); + irPtr = TclFetchIntRep(objPtr, &tclByteArrayType); } } } @@ -553,10 +553,10 @@ SetByteArrayFromAny( ByteArray *byteArrayPtr; Tcl_ObjIntRep ir; - if (Tcl_FetchIntRep(objPtr, &properByteArrayType)) { + if (objPtr->typePtr == &properByteArrayType) { return TCL_OK; } - if (Tcl_FetchIntRep(objPtr, &tclByteArrayType)) { + if (objPtr->typePtr == &tclByteArrayType) { return TCL_OK; } @@ -602,14 +602,14 @@ static void FreeByteArrayInternalRep( Tcl_Obj *objPtr) /* Object with internal rep to free. */ { - Tcl_Free(GET_BYTEARRAY(Tcl_FetchIntRep(objPtr, &tclByteArrayType))); + Tcl_Free(GET_BYTEARRAY(TclFetchIntRep(objPtr, &tclByteArrayType))); } static void FreeProperByteArrayInternalRep( Tcl_Obj *objPtr) /* Object with internal rep to free. */ { - Tcl_Free(GET_BYTEARRAY(Tcl_FetchIntRep(objPtr, &properByteArrayType))); + Tcl_Free(GET_BYTEARRAY(TclFetchIntRep(objPtr, &properByteArrayType))); } /* @@ -638,7 +638,7 @@ DupByteArrayInternalRep( ByteArray *srcArrayPtr, *copyArrayPtr; Tcl_ObjIntRep ir; - srcArrayPtr = GET_BYTEARRAY(Tcl_FetchIntRep(srcPtr, &tclByteArrayType)); + srcArrayPtr = GET_BYTEARRAY(TclFetchIntRep(srcPtr, &tclByteArrayType)); length = srcArrayPtr->used; copyArrayPtr = Tcl_Alloc(BYTEARRAY_SIZE(length)); @@ -659,7 +659,7 @@ DupProperByteArrayInternalRep( ByteArray *srcArrayPtr, *copyArrayPtr; Tcl_ObjIntRep ir; - srcArrayPtr = GET_BYTEARRAY(Tcl_FetchIntRep(srcPtr, &properByteArrayType)); + srcArrayPtr = GET_BYTEARRAY(TclFetchIntRep(srcPtr, &properByteArrayType)); length = srcArrayPtr->used; copyArrayPtr = Tcl_Alloc(BYTEARRAY_SIZE(length)); @@ -693,7 +693,7 @@ UpdateStringOfByteArray( Tcl_Obj *objPtr) /* ByteArray object whose string rep to * update. */ { - const Tcl_ObjIntRep *irPtr = Tcl_FetchIntRep(objPtr, &properByteArrayType); + const Tcl_ObjIntRep *irPtr = TclFetchIntRep(objPtr, &properByteArrayType); ByteArray *byteArrayPtr = GET_BYTEARRAY(irPtr); unsigned char *src = byteArrayPtr->bytes; size_t i, length = byteArrayPtr->used; @@ -763,14 +763,14 @@ TclAppendBytesToByteArray( return; } - irPtr = Tcl_FetchIntRep(objPtr, &properByteArrayType); + irPtr = TclFetchIntRep(objPtr, &properByteArrayType); if (irPtr == NULL) { - irPtr = Tcl_FetchIntRep(objPtr, &tclByteArrayType); + irPtr = TclFetchIntRep(objPtr, &tclByteArrayType); if (irPtr == NULL) { SetByteArrayFromAny(NULL, objPtr); - irPtr = Tcl_FetchIntRep(objPtr, &properByteArrayType); + irPtr = TclFetchIntRep(objPtr, &properByteArrayType); if (irPtr == NULL) { - irPtr = Tcl_FetchIntRep(objPtr, &tclByteArrayType); + irPtr = TclFetchIntRep(objPtr, &tclByteArrayType); } } } @@ -2017,7 +2017,7 @@ FormatNumber( */ if (Tcl_GetDoubleFromObj(interp, src, &dvalue) != TCL_OK) { - const Tcl_ObjIntRep *irPtr = Tcl_FetchIntRep(src, &tclDoubleType); + const Tcl_ObjIntRep *irPtr = TclFetchIntRep(src, &tclDoubleType); if (irPtr == NULL) { return TCL_ERROR; } @@ -2037,7 +2037,7 @@ FormatNumber( */ if (Tcl_GetDoubleFromObj(interp, src, &dvalue) != TCL_OK) { - const Tcl_ObjIntRep *irPtr = Tcl_FetchIntRep(src, &tclDoubleType); + const Tcl_ObjIntRep *irPtr = TclFetchIntRep(src, &tclDoubleType); if (irPtr == NULL) { return TCL_ERROR; } diff --git a/generic/tclClock.c b/generic/tclClock.c index ef2413a..f9a8008 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -452,7 +452,7 @@ ClockGetdatefieldsObjCmd( * that it isn't. */ - if (Tcl_FetchIntRep(objv[1], &tclBignumType)) { + if (objv[1]->typePtr == &tclBignumType) { Tcl_SetObjResult(interp, literals[LIT_INTEGER_VALUE_TOO_LARGE]); return TCL_ERROR; } diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index f9ce267..75dac00 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.c @@ -1651,9 +1651,9 @@ StringIsCmd( chcomp = Tcl_UniCharIsDigit; break; case STR_IS_DOUBLE: { - if (Tcl_FetchIntRep(objPtr, &tclDoubleType) || - Tcl_FetchIntRep(objPtr, &tclIntType) || - Tcl_FetchIntRep(objPtr, &tclBignumType)) { + if ((objPtr->typePtr == &tclDoubleType) || + (objPtr->typePtr == &tclIntType) || + (objPtr->typePtr == &tclBignumType)) { break; } string1 = TclGetStringFromObj(objPtr, &length1); @@ -1682,8 +1682,8 @@ StringIsCmd( break; case STR_IS_INT: case STR_IS_ENTIER: - if (Tcl_FetchIntRep(objPtr, &tclIntType) || - Tcl_FetchIntRep(objPtr, &tclBignumType)) { + if ((objPtr->typePtr == &tclIntType) || + (objPtr->typePtr == &tclBignumType)) { break; } string1 = TclGetStringFromObj(objPtr, &length1); @@ -1964,7 +1964,7 @@ StringMapCmd( */ if (!TclHasStringRep(objv[objc-2]) - && Tcl_FetchIntRep(objv[objc-2], &tclDictType)){ + && (objv[objc-2]->typePtr == &tclDictType)){ int i, done; Tcl_DictSearch search; diff --git a/generic/tclCompile.h b/generic/tclCompile.h index 6199c60..5d77009 100644 --- a/generic/tclCompile.h +++ b/generic/tclCompile.h @@ -528,7 +528,7 @@ typedef struct ByteCode { #define ByteCodeGetIntRep(objPtr, typePtr, codePtr) \ do { \ const Tcl_ObjIntRep *irPtr; \ - irPtr = Tcl_FetchIntRep((objPtr), (typePtr)); \ + irPtr = TclFetchIntRep((objPtr), (typePtr)); \ (codePtr) = irPtr ? irPtr->twoPtrValue.ptr1 : NULL; \ } while (0) diff --git a/generic/tclDictObj.c b/generic/tclDictObj.c index 3875967..9462581 100644 --- a/generic/tclDictObj.c +++ b/generic/tclDictObj.c @@ -173,7 +173,7 @@ const Tcl_ObjType tclDictType = { #define DictGetIntRep(objPtr, dictRepPtr) \ do { \ const Tcl_ObjIntRep *irPtr; \ - irPtr = Tcl_FetchIntRep((objPtr), &tclDictType); \ + irPtr = TclFetchIntRep((objPtr), &tclDictType); \ (dictRepPtr) = irPtr ? irPtr->twoPtrValue.ptr1 : NULL; \ } while (0) @@ -617,7 +617,7 @@ SetDictFromAny( * the conversion from lists to dictionaries. */ - if (Tcl_FetchIntRep(objPtr, &tclListType)) { + if (objPtr->typePtr == &tclListType) { int objc, i; Tcl_Obj **objv; diff --git a/generic/tclDisassemble.c b/generic/tclDisassemble.c index c36412d..9847b6b 100644 --- a/generic/tclDisassemble.c +++ b/generic/tclDisassemble.c @@ -56,7 +56,7 @@ static const Tcl_ObjType instNameType = { #define InstNameGetIntRep(objPtr, inst) \ do { \ const Tcl_ObjIntRep *irPtr; \ - irPtr = Tcl_FetchIntRep((objPtr), &instNameType); \ + irPtr = TclFetchIntRep((objPtr), &instNameType); \ assert(irPtr != NULL); \ (inst) = (size_t)irPtr->wideValue; \ } while (0) @@ -1383,7 +1383,7 @@ Tcl_DisassembleObjCmd( return TCL_ERROR; } - if ((NULL == Tcl_FetchIntRep(objv[2], &tclByteCodeType)) && (TCL_OK + if ((objv[2]->typePtr != &tclByteCodeType) && (TCL_OK != TclSetByteCodeFromAny(interp, objv[2], NULL, NULL))) { return TCL_ERROR; } @@ -1584,7 +1584,7 @@ Tcl_DisassembleObjCmd( "METHODTYPE", NULL); return TCL_ERROR; } - if (NULL == Tcl_FetchIntRep(procPtr->bodyPtr, &tclByteCodeType)) { + if (procPtr->bodyPtr->typePtr != &tclByteCodeType) { Command cmd; /* diff --git a/generic/tclEncoding.c b/generic/tclEncoding.c index cd388f4..6abefa9 100644 --- a/generic/tclEncoding.c +++ b/generic/tclEncoding.c @@ -290,7 +290,7 @@ static const Tcl_ObjType encodingType = { #define EncodingGetIntRep(objPtr, encoding) \ do { \ const Tcl_ObjIntRep *irPtr; \ - irPtr = Tcl_FetchIntRep ((objPtr), &encodingType); \ + irPtr = TclFetchIntRep ((objPtr), &encodingType); \ (encoding) = irPtr ? irPtr->twoPtrValue.ptr1 : NULL; \ } while (0) diff --git a/generic/tclEnsemble.c b/generic/tclEnsemble.c index c92a68c..ef3b0cf 100644 --- a/generic/tclEnsemble.c +++ b/generic/tclEnsemble.c @@ -95,7 +95,7 @@ static const Tcl_ObjType ensembleCmdType = { #define ECRGetIntRep(objPtr, ecRepPtr) \ do { \ const Tcl_ObjIntRep *irPtr; \ - irPtr = Tcl_FetchIntRep((objPtr), &ensembleCmdType); \ + irPtr = TclFetchIntRep((objPtr), &ensembleCmdType); \ (ecRepPtr) = irPtr ? irPtr->twoPtrValue.ptr1 : NULL; \ } while (0) diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 49a1b4a..a30cd4b 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -692,7 +692,7 @@ ReleaseDictIterator( Tcl_Obj *dictPtr; const Tcl_ObjIntRep *irPtr; - irPtr = Tcl_FetchIntRep(objPtr, &dictIteratorType); + irPtr = TclFetchIntRep(objPtr, &dictIteratorType); assert(irPtr != NULL); /* @@ -4559,7 +4559,7 @@ TEBCresume( */ if ((TclListObjGetElements(interp, valuePtr, &objc, &objv) == TCL_OK) - && (NULL == Tcl_FetchIntRep(value2Ptr, &tclListType)) + && (value2Ptr->typePtr != &tclListType) && (TclGetIntForIndexM(NULL, value2Ptr, objc-1, &index) == TCL_OK)) { TclDecrRefCount(value2Ptr); @@ -6738,7 +6738,7 @@ TEBCresume( } varPtr = LOCAL(opnd); if (varPtr->value.objPtr) { - if (Tcl_FetchIntRep(varPtr->value.objPtr, &dictIteratorType)) { + if (varPtr->value.objPtr->typePtr == &dictIteratorType) { Tcl_Panic("mis-issued dictFirst!"); } TclDecrRefCount(varPtr->value.objPtr); @@ -6755,7 +6755,7 @@ TEBCresume( const Tcl_ObjIntRep *irPtr; if (statePtr && - (irPtr = Tcl_FetchIntRep(statePtr, &dictIteratorType))) { + (irPtr = TclFetchIntRep(statePtr, &dictIteratorType))) { searchPtr = irPtr->twoPtrValue.ptr1; Tcl_DictObjNext(searchPtr, &keyPtr, &valuePtr, &done); } else { @@ -9246,7 +9246,7 @@ EvalStatsCmd( for (i = 0; i < globalTablePtr->numBuckets; i++) { for (entryPtr = globalTablePtr->buckets[i]; entryPtr != NULL; entryPtr = entryPtr->nextPtr) { - if (NULL != Tcl_FetchIntRep(entryPtr->objPtr, &tclByteCodeType)) { + if (entryPtr->objPtr->typePtr == &tclByteCodeType) { numByteCodeLits++; } (void) TclGetStringFromObj(entryPtr->objPtr, &length); diff --git a/generic/tclIO.c b/generic/tclIO.c index ca4f461..da6c4f1 100644 --- a/generic/tclIO.c +++ b/generic/tclIO.c @@ -349,7 +349,7 @@ static const Tcl_ObjType chanObjType = { #define ChanGetIntRep(objPtr, resPtr) \ do { \ const Tcl_ObjIntRep *irPtr; \ - irPtr = Tcl_FetchIntRep((objPtr), &chanObjType); \ + irPtr = TclFetchIntRep((objPtr), &chanObjType); \ (resPtr) = irPtr ? irPtr->twoPtrValue.ptr1 : NULL; \ } while (0) diff --git a/generic/tclIndexObj.c b/generic/tclIndexObj.c index db267de..33656d6 100644 --- a/generic/tclIndexObj.c +++ b/generic/tclIndexObj.c @@ -213,7 +213,7 @@ Tcl_GetIndexFromObjStruct( */ if (!(flags & INDEX_TEMP_TABLE)) { - irPtr = Tcl_FetchIntRep(objPtr, &indexType); + irPtr = TclFetchIntRep(objPtr, &indexType); if (irPtr) { indexRep = irPtr->twoPtrValue.ptr1; if (indexRep->tablePtr==tablePtr && indexRep->offset==offset) { @@ -277,7 +277,7 @@ Tcl_GetIndexFromObjStruct( */ if (!(flags & INDEX_TEMP_TABLE)) { - irPtr = Tcl_FetchIntRep(objPtr, &indexType); + irPtr = TclFetchIntRep(objPtr, &indexType); if (irPtr) { indexRep = irPtr->twoPtrValue.ptr1; } else { @@ -388,7 +388,7 @@ static void UpdateStringOfIndex( Tcl_Obj *objPtr) { - IndexRep *indexRep = Tcl_FetchIntRep(objPtr, &indexType)->twoPtrValue.ptr1; + IndexRep *indexRep = TclFetchIntRep(objPtr, &indexType)->twoPtrValue.ptr1; register const char *indexStr = EXPAND_OF(indexRep); Tcl_InitStringRep(objPtr, indexStr, strlen(indexStr)); @@ -420,7 +420,7 @@ DupIndex( Tcl_ObjIntRep ir; IndexRep *dupIndexRep = Tcl_Alloc(sizeof(IndexRep)); - memcpy(dupIndexRep, Tcl_FetchIntRep(srcPtr, &indexType)->twoPtrValue.ptr1, + memcpy(dupIndexRep, TclFetchIntRep(srcPtr, &indexType)->twoPtrValue.ptr1, sizeof(IndexRep)); ir.twoPtrValue.ptr1 = dupIndexRep; @@ -448,7 +448,7 @@ static void FreeIndex( Tcl_Obj *objPtr) { - Tcl_Free(Tcl_FetchIntRep(objPtr, &indexType)->twoPtrValue.ptr1); + Tcl_Free(TclFetchIntRep(objPtr, &indexType)->twoPtrValue.ptr1); objPtr->typePtr = NULL; } @@ -875,7 +875,7 @@ Tcl_WrongNumArgs( */ const Tcl_ObjIntRep *irPtr; - if ((irPtr = Tcl_FetchIntRep(origObjv[i], &indexType))) { + if ((irPtr = TclFetchIntRep(origObjv[i], &indexType))) { register IndexRep *indexRep = irPtr->twoPtrValue.ptr1; elementStr = EXPAND_OF(indexRep); @@ -922,7 +922,7 @@ Tcl_WrongNumArgs( */ const Tcl_ObjIntRep *irPtr; - if ((irPtr = Tcl_FetchIntRep(objv[i], &indexType))) { + if ((irPtr = TclFetchIntRep(objv[i], &indexType))) { register IndexRep *indexRep = irPtr->twoPtrValue.ptr1; Tcl_AppendStringsToObj(objPtr, EXPAND_OF(indexRep), NULL); diff --git a/generic/tclInt.h b/generic/tclInt.h index f820b57..aa312c4 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -4575,6 +4575,8 @@ MODULE_SCOPE void TclDbInitNewObj(Tcl_Obj *objPtr, const char *file, MODULE_SCOPE int TclIsPureByteArray(Tcl_Obj *objPtr); #define TclIsPureDict(objPtr) \ (((objPtr)->bytes==NULL) && ((objPtr)->typePtr==&tclDictType)) +#define TclFetchIntRep(objPtr, type) \ + (((objPtr)->typePtr == type) ? &((objPtr)->internalRep) : NULL) /* diff --git a/generic/tclLink.c b/generic/tclLink.c index 6227d85..1ae8501 100644 --- a/generic/tclLink.c +++ b/generic/tclLink.c @@ -416,7 +416,7 @@ LinkTraceProc( case TCL_LINK_DOUBLE: if (Tcl_GetDoubleFromObj(NULL, valueObj, &linkPtr->lastValue.d) != TCL_OK) { #ifdef ACCEPT_NAN - Tcl_ObjIntRep *irPtr = Tcl_FetchIntRep(valueObj, &tclDoubleType); + Tcl_ObjIntRep *irPtr = TclFetchIntRep(valueObj, &tclDoubleType); if (irPtr == NULL) { #endif if (GetInvalidDoubleFromObj(valueObj, &linkPtr->lastValue.d) != TCL_OK) { diff --git a/generic/tclListObj.c b/generic/tclListObj.c index e74a603..504af4b 100644 --- a/generic/tclListObj.c +++ b/generic/tclListObj.c @@ -61,12 +61,12 @@ const Tcl_ObjType tclListType = { #define ListGetIntRep(objPtr, listRepPtr) \ do { \ const Tcl_ObjIntRep *irPtr; \ - irPtr = Tcl_FetchIntRep((objPtr), &tclListType); \ + irPtr = TclFetchIntRep((objPtr), &tclListType); \ (listRepPtr) = irPtr ? irPtr->twoPtrValue.ptr1 : NULL; \ } while (0) #define ListResetIntRep(objPtr, listRepPtr) \ - Tcl_FetchIntRep((objPtr), &tclListType)->twoPtrValue.ptr1 = (listRepPtr) + TclFetchIntRep((objPtr), &tclListType)->twoPtrValue.ptr1 = (listRepPtr) #ifndef TCL_MIN_ELEMENT_GROWTH #define TCL_MIN_ELEMENT_GROWTH TCL_MIN_GROWTH/sizeof(Tcl_Obj *) @@ -1634,7 +1634,7 @@ TclLsetFlat( * them at that time. */ - irPtr = Tcl_FetchIntRep(parentList, &tclListType); + irPtr = TclFetchIntRep(parentList, &tclListType); irPtr->twoPtrValue.ptr2 = chainPtr; chainPtr = parentList; } @@ -1655,7 +1655,7 @@ TclLsetFlat( * Clear away our intrep surgery mess. */ - irPtr = Tcl_FetchIntRep(objPtr, &tclListType); + irPtr = TclFetchIntRep(objPtr, &tclListType); listRepPtr = irPtr->twoPtrValue.ptr1; chainPtr = irPtr->twoPtrValue.ptr2; @@ -1976,7 +1976,7 @@ SetListFromAny( * describe duplicate keys). */ - if (!TclHasStringRep(objPtr) && Tcl_FetchIntRep(objPtr, &tclDictType)) { + if (!TclHasStringRep(objPtr) && (objPtr->typePtr == &tclDictType)) { Tcl_Obj *keyPtr, *valuePtr; Tcl_DictSearch search; int done, size; diff --git a/generic/tclNamesp.c b/generic/tclNamesp.c index 60e2af4..48a0e34 100644 --- a/generic/tclNamesp.c +++ b/generic/tclNamesp.c @@ -165,7 +165,7 @@ static const Tcl_ObjType nsNameType = { #define NsNameGetIntRep(objPtr, nnPtr) \ do { \ const Tcl_ObjIntRep *irPtr; \ - irPtr = Tcl_FetchIntRep((objPtr), &nsNameType); \ + irPtr = TclFetchIntRep((objPtr), &nsNameType); \ (nnPtr) = irPtr ? irPtr->twoPtrValue.ptr1 : NULL; \ } while (0) diff --git a/generic/tclOOCall.c b/generic/tclOOCall.c index c50f72f..596d036 100644 --- a/generic/tclOOCall.c +++ b/generic/tclOOCall.c @@ -280,7 +280,7 @@ DupMethodNameRep( Tcl_Obj *dstPtr) { StashCallChain(dstPtr, - Tcl_FetchIntRep(srcPtr, &methodNameType)->twoPtrValue.ptr1); + TclFetchIntRep(srcPtr, &methodNameType)->twoPtrValue.ptr1); } static void @@ -288,7 +288,7 @@ FreeMethodNameRep( Tcl_Obj *objPtr) { TclOODeleteChain( - Tcl_FetchIntRep(objPtr, &methodNameType)->twoPtrValue.ptr1); + TclFetchIntRep(objPtr, &methodNameType)->twoPtrValue.ptr1); } /* @@ -1189,7 +1189,7 @@ TclOOGetCallContext( const Tcl_ObjIntRep *irPtr; const int reuseMask = (WANT_PUBLIC(flags) ? ~0 : ~PUBLIC_METHOD); - if ((irPtr = Tcl_FetchIntRep(cacheInThisObj, &methodNameType))) { + if ((irPtr = TclFetchIntRep(cacheInThisObj, &methodNameType))) { callPtr = irPtr->twoPtrValue.ptr1; if (IsStillValid(callPtr, oPtr, flags, reuseMask)) { callPtr->refCount++; diff --git a/generic/tclObj.c b/generic/tclObj.c index 9807cb2..d6a6c80 100644 --- a/generic/tclObj.c +++ b/generic/tclObj.c @@ -1880,13 +1880,7 @@ Tcl_FetchIntRep( Tcl_Obj *objPtr, /* Object to fetch from. */ const Tcl_ObjType *typePtr) /* Requested type */ { - /* If objPtr type doesn't match request, nothing can be fetched */ - if (objPtr->typePtr != typePtr) { - return NULL; - } - - /* Type match! objPtr IntRep is the one sought. */ - return &(objPtr->internalRep); + return TclFetchIntRep(objPtr, typePtr); } /* diff --git a/generic/tclPathObj.c b/generic/tclPathObj.c index 8cf089d..d53b05c 100644 --- a/generic/tclPathObj.c +++ b/generic/tclPathObj.c @@ -101,7 +101,7 @@ typedef struct { * fields. */ -#define PATHOBJ(pathPtr) ((FsPath *) (Tcl_FetchIntRep((pathPtr), &fsPathType)->twoPtrValue.ptr1)) +#define PATHOBJ(pathPtr) ((FsPath *) (TclFetchIntRep((pathPtr), &fsPathType)->twoPtrValue.ptr1)) #define SETPATHOBJ(pathPtr,fsPathPtr) \ do { \ Tcl_ObjIntRep ir; \ @@ -560,7 +560,7 @@ TclPathPart( Tcl_Obj *pathPtr, /* Path to take dirname of */ Tcl_PathPart portion) /* Requested portion of name */ { - Tcl_ObjIntRep *irPtr = Tcl_FetchIntRep(pathPtr, &fsPathType); + Tcl_ObjIntRep *irPtr = TclFetchIntRep(pathPtr, &fsPathType); if (irPtr) { FsPath *fsPathPtr = PATHOBJ(pathPtr); @@ -860,7 +860,7 @@ TclJoinPath( if (elements == 2) { Tcl_Obj *elt = objv[0]; - Tcl_ObjIntRep *eltIr = Tcl_FetchIntRep(elt, &fsPathType); + Tcl_ObjIntRep *eltIr = TclFetchIntRep(elt, &fsPathType); /* * This is a special case where we can be much more efficient, where @@ -1156,7 +1156,7 @@ Tcl_FSConvertToPathType( Tcl_Obj *pathPtr) /* Object to convert to a valid, current path * type. */ { - Tcl_ObjIntRep *irPtr = Tcl_FetchIntRep(pathPtr, &fsPathType); + Tcl_ObjIntRep *irPtr = TclFetchIntRep(pathPtr, &fsPathType); /* * While it is bad practice to examine an object's type directly, this is @@ -1409,7 +1409,7 @@ TclFSMakePathRelative( { int cwdLen, len; const char *tempStr; - Tcl_ObjIntRep *irPtr = Tcl_FetchIntRep(pathPtr, &fsPathType); + Tcl_ObjIntRep *irPtr = TclFetchIntRep(pathPtr, &fsPathType); if (irPtr) { FsPath *fsPathPtr = PATHOBJ(pathPtr); @@ -1478,7 +1478,7 @@ MakePathFromNormalized( Tcl_Obj *pathPtr) /* The object to convert. */ { FsPath *fsPathPtr; - Tcl_ObjIntRep *irPtr = Tcl_FetchIntRep(pathPtr, &fsPathType); + Tcl_ObjIntRep *irPtr = TclFetchIntRep(pathPtr, &fsPathType); if (irPtr) { return TCL_OK; @@ -1619,7 +1619,7 @@ Tcl_FSGetTranslatedPath( retObj = Tcl_FSJoinToPath(translatedCwdPtr, 1, &srcFsPathPtr->normPathPtr); Tcl_IncrRefCount(srcFsPathPtr->translatedPathPtr = retObj); - translatedCwdIrPtr = Tcl_FetchIntRep(translatedCwdPtr, &fsPathType); + translatedCwdIrPtr = TclFetchIntRep(translatedCwdPtr, &fsPathType); if (translatedCwdIrPtr) { srcFsPathPtr->filesystemEpoch = PATHOBJ(translatedCwdPtr)->filesystemEpoch; @@ -2084,7 +2084,7 @@ TclFSEnsureEpochOk( const Tcl_Filesystem **fsPtrPtr) { FsPath *srcFsPathPtr; - Tcl_ObjIntRep *irPtr = Tcl_FetchIntRep(pathPtr, &fsPathType); + Tcl_ObjIntRep *irPtr = TclFetchIntRep(pathPtr, &fsPathType); if (irPtr == NULL) { return TCL_OK; @@ -2143,7 +2143,7 @@ TclFSSetPathDetails( ClientData clientData) { FsPath *srcFsPathPtr; - Tcl_ObjIntRep *irPtr = Tcl_FetchIntRep(pathPtr, &fsPathType);; + Tcl_ObjIntRep *irPtr = TclFetchIntRep(pathPtr, &fsPathType);; /* * Make sure pathPtr is of the correct type. @@ -2248,7 +2248,7 @@ SetFsPathFromAny( FsPath *fsPathPtr; Tcl_Obj *transPtr; char *name; - Tcl_ObjIntRep *irPtr = Tcl_FetchIntRep(pathPtr, &fsPathType); + Tcl_ObjIntRep *irPtr = TclFetchIntRep(pathPtr, &fsPathType); if (irPtr) { return TCL_OK; @@ -2556,7 +2556,7 @@ TclNativePathInFilesystem( Tcl_Obj *pathPtr, ClientData *clientDataPtr) { - Tcl_ObjIntRep *irPtr = Tcl_FetchIntRep(pathPtr, &fsPathType); + Tcl_ObjIntRep *irPtr = TclFetchIntRep(pathPtr, &fsPathType); /* * A special case is required to handle the empty path "". This is a valid diff --git a/generic/tclProc.c b/generic/tclProc.c index 8c2309d..0de0dd6 100644 --- a/generic/tclProc.c +++ b/generic/tclProc.c @@ -80,7 +80,7 @@ const Tcl_ObjType tclProcBodyType = { #define ProcGetIntRep(objPtr, procPtr) \ do { \ const Tcl_ObjIntRep *irPtr; \ - irPtr = Tcl_FetchIntRep((objPtr), &tclProcBodyType); \ + irPtr = TclFetchIntRep((objPtr), &tclProcBodyType); \ (procPtr) = irPtr ? irPtr->twoPtrValue.ptr1 : NULL; \ } while (0) @@ -126,7 +126,7 @@ static const Tcl_ObjType lambdaType = { #define LambdaGetIntRep(objPtr, procPtr, nsObjPtr) \ do { \ const Tcl_ObjIntRep *irPtr; \ - irPtr = Tcl_FetchIntRep((objPtr), &lambdaType); \ + irPtr = TclFetchIntRep((objPtr), &lambdaType); \ (procPtr) = irPtr ? irPtr->twoPtrValue.ptr1 : NULL; \ (nsObjPtr) = irPtr ? irPtr->twoPtrValue.ptr2 : NULL; \ } while (0) @@ -329,7 +329,7 @@ Tcl_ProcObjCmd( * of all procs whose argument list is just _args_ */ - if (Tcl_FetchIntRep(objv[3], &tclProcBodyType)) { + if (TclFetchIntRep(objv[3], &tclProcBodyType)) { goto done; } @@ -796,7 +796,7 @@ TclObjGetFrame( level = curLevel - level; result = 1; } - } else if ((irPtr = Tcl_FetchIntRep(objPtr, &levelReferenceType))) { + } else if ((irPtr = TclFetchIntRep(objPtr, &levelReferenceType))) { level = irPtr->wideValue; result = 1; } else { diff --git a/generic/tclRegexp.c b/generic/tclRegexp.c index 2cd41a9..65bc94e 100644 --- a/generic/tclRegexp.c +++ b/generic/tclRegexp.c @@ -121,7 +121,7 @@ const Tcl_ObjType tclRegexpType = { #define RegexpGetIntRep(objPtr, rePtr) \ do { \ const Tcl_ObjIntRep *irPtr; \ - irPtr = Tcl_FetchIntRep((objPtr), &tclRegexpType); \ + irPtr = TclFetchIntRep((objPtr), &tclRegexpType); \ (rePtr) = irPtr ? irPtr->twoPtrValue.ptr1 : NULL; \ } while (0) diff --git a/generic/tclScan.c b/generic/tclScan.c index 8ddee45..bf611fc 100644 --- a/generic/tclScan.c +++ b/generic/tclScan.c @@ -1010,7 +1010,7 @@ Tcl_ScanObjCmd( if (Tcl_GetDoubleFromObj(NULL, objPtr, &dvalue) != TCL_OK) { #ifdef ACCEPT_NAN const Tcl_ObjIntRep *irPtr - = Tcl_FetchIntRep(objPtr, &tclDoubleType); + = TclFetchIntRep(objPtr, &tclDoubleType); if (irPtr) { dvalue = irPtr->doubleValue; } else diff --git a/generic/tclUtil.c b/generic/tclUtil.c index 4edbff3..6481283 100644 --- a/generic/tclUtil.c +++ b/generic/tclUtil.c @@ -3679,7 +3679,7 @@ GetEndOffsetFromObj( Tcl_ObjIntRep *irPtr; Tcl_WideInt offset = 0; /* Offset in the "end-offset" expression */ - while ((irPtr = Tcl_FetchIntRep(objPtr, &endOffsetType)) == NULL) { + while ((irPtr = TclFetchIntRep(objPtr, &endOffsetType)) == NULL) { Tcl_ObjIntRep ir; size_t length; const char *bytes = TclGetStringFromObj(objPtr, &length); diff --git a/generic/tclVar.c b/generic/tclVar.c index b467786..c4d95b6 100644 --- a/generic/tclVar.c +++ b/generic/tclVar.c @@ -267,7 +267,7 @@ static const Tcl_ObjType localVarNameType = { #define LocalGetIntRep(objPtr, index, name) \ do { \ const Tcl_ObjIntRep *irPtr; \ - irPtr = Tcl_FetchIntRep((objPtr), &localVarNameType); \ + irPtr = TclFetchIntRep((objPtr), &localVarNameType); \ (name) = irPtr ? irPtr->twoPtrValue.ptr1 : NULL; \ (index) = irPtr ? PTR2INT(irPtr->twoPtrValue.ptr2) : -1; \ } while (0) @@ -292,7 +292,7 @@ static const Tcl_ObjType parsedVarNameType = { #define ParsedGetIntRep(objPtr, parsed, array, elem) \ do { \ const Tcl_ObjIntRep *irPtr; \ - irPtr = Tcl_FetchIntRep((objPtr), &parsedVarNameType); \ + irPtr = TclFetchIntRep((objPtr), &parsedVarNameType); \ (parsed) = (irPtr != NULL); \ (array) = irPtr ? irPtr->twoPtrValue.ptr1 : NULL; \ (elem) = irPtr ? irPtr->twoPtrValue.ptr2 : NULL; \ |