diff options
| author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2022-04-26 15:41:42 (GMT) |
|---|---|---|
| committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2022-04-26 15:41:42 (GMT) |
| commit | 208f8c30a1c20162f7ec27c09afb7818153f254d (patch) | |
| tree | afd9f2d53d123c144ea98524e210756e8082226c | |
| parent | a69bdcf1eea657ee8dfe8cba2071b0ed269531ea (diff) | |
| parent | 9f54abf33a1289128b25b82e8a2d53013463801e (diff) | |
| download | tcl-208f8c30a1c20162f7ec27c09afb7818153f254d.zip tcl-208f8c30a1c20162f7ec27c09afb7818153f254d.tar.gz tcl-208f8c30a1c20162f7ec27c09afb7818153f254d.tar.bz2 | |
Merge 8.7
| -rw-r--r-- | generic/tcl.h | 6 | ||||
| -rw-r--r-- | generic/tclDecls.h | 4 | ||||
| -rw-r--r-- | generic/tclIndexObj.c | 21 |
3 files changed, 16 insertions, 15 deletions
diff --git a/generic/tcl.h b/generic/tcl.h index 7294cf9..676784d 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -824,15 +824,15 @@ typedef struct Tcl_DString { /* * Flags that may be passed to Tcl_GetIndexFromObj. * TCL_EXACT disallows abbreviated strings. - * TCL_INDEX_TEMP_TABLE disallows caching of lookups. A possible use case is - * a table that will not live long enough to make it worthwhile. * TCL_INDEX_NULL_OK allows the empty string or NULL to return TCL_OK. * The returned value will be -1; + * TCL_INDEX_TEMP_TABLE disallows caching of lookups. A possible use case is + * a table that will not live long enough to make it worthwhile. */ #define TCL_EXACT 1 -#define TCL_INDEX_TEMP_TABLE 2 #define TCL_INDEX_NULL_OK 32 +#define TCL_INDEX_TEMP_TABLE 64 /* *---------------------------------------------------------------------------- diff --git a/generic/tclDecls.h b/generic/tclDecls.h index c5f89b5..41215d5 100644 --- a/generic/tclDecls.h +++ b/generic/tclDecls.h @@ -3919,7 +3919,7 @@ extern const TclStubs *tclStubsPtr; #define Tcl_GetUnicodeFromObj(objPtr, sizePtr) \ (sizeof(*(sizePtr)) <= sizeof(int) ? tclStubsPtr->tclGetUnicodeFromObj(objPtr, (int *)(sizePtr)) : tclStubsPtr->tcl_GetUnicodeFromObj(objPtr, (size_t *)(sizePtr))) #define Tcl_GetIndexFromObjStruct(interp, objPtr, tablePtr, offset, msg, flags, indexPtr) \ - (tclStubsPtr->tcl_GetIndexFromObjStruct((interp), (objPtr), (tablePtr), (offset), (msg), (flags)|(int)(sizeof(*(indexPtr))<<8), (indexPtr))) + (tclStubsPtr->tcl_GetIndexFromObjStruct((interp), (objPtr), (tablePtr), (offset), (msg), (flags)|(int)(sizeof(*(indexPtr))<<1), (indexPtr))) #else #define Tcl_GetStringFromObj(objPtr, sizePtr) \ (sizeof(*(sizePtr)) <= sizeof(int) ? (TclGetStringFromObj)(objPtr, (int *)(sizePtr)) : (Tcl_GetStringFromObj)(objPtr, (size_t *)(sizePtr))) @@ -3930,7 +3930,7 @@ extern const TclStubs *tclStubsPtr; #define Tcl_GetUnicodeFromObj(objPtr, sizePtr) \ (sizeof(*(sizePtr)) <= sizeof(int) ? (TclGetUnicodeFromObj)(objPtr, (int *)(sizePtr)) : Tcl_GetUnicodeFromObj(objPtr, (size_t *)(sizePtr))) #define Tcl_GetIndexFromObjStruct(interp, objPtr, tablePtr, offset, msg, flags, indexPtr) \ - ((Tcl_GetIndexFromObjStruct)((interp), (objPtr), (tablePtr), (offset), (msg), (flags)|(int)(sizeof(*(indexPtr))<<8), (indexPtr))) + ((Tcl_GetIndexFromObjStruct)((interp), (objPtr), (tablePtr), (offset), (msg), (flags)|(int)(sizeof(*(indexPtr))<<1), (indexPtr))) #endif #ifdef TCL_MEM_DEBUG diff --git a/generic/tclIndexObj.c b/generic/tclIndexObj.c index c369827..567bdc5 100644 --- a/generic/tclIndexObj.c +++ b/generic/tclIndexObj.c @@ -300,20 +300,21 @@ Tcl_GetIndexFromObjStruct( uncachedDone: if (indexPtr != NULL) { - if ((flags>>8) & (int)~sizeof(int)) { - if ((flags>>8) == sizeof(uint64_t)) { - *(uint64_t *)indexPtr = index; - return TCL_OK; - } else if ((flags>>8) == sizeof(uint32_t)) { - *(uint32_t *)indexPtr = index; - return TCL_OK; - } else if ((flags>>8) == sizeof(uint16_t)) { + flags &= (30-(int)(sizeof(int)<<1)); + if (flags) { + if (flags == sizeof(uint16_t)<<1) { *(uint16_t *)indexPtr = index; return TCL_OK; - } else if ((flags>>8) == sizeof(uint8_t)) { + } else if (flags == (int)(sizeof(uint8_t)<<1)) { *(uint8_t *)indexPtr = index; return TCL_OK; - } + } else if (flags == (int)(sizeof(int64_t)<<1)) { + *(int64_t *)indexPtr = index; + return TCL_OK; + } else if (flags == (int)(sizeof(int32_t)<<1)) { + *(int32_t *)indexPtr = index; + return TCL_OK; + } } *(int *)indexPtr = index; } |
