summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2022-04-26 15:57:10 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2022-04-26 15:57:10 (GMT)
commitf311a1d160bc774b33a2f365e33511c4d095bcc0 (patch)
treecb6ea9fb291512522727c8d8e01aada2ebe023f0 /generic
parent0d55b56ce99bccd691b4413001fab8d7632cdae1 (diff)
parent9f54abf33a1289128b25b82e8a2d53013463801e (diff)
downloadtcl-f311a1d160bc774b33a2f365e33511c4d095bcc0.zip
tcl-f311a1d160bc774b33a2f365e33511c4d095bcc0.tar.gz
tcl-f311a1d160bc774b33a2f365e33511c4d095bcc0.tar.bz2
Merge 8.7
Diffstat (limited to 'generic')
-rw-r--r--generic/tcl.h6
-rw-r--r--generic/tclCompCmdsSZ.c3
-rw-r--r--generic/tclDecls.h4
-rw-r--r--generic/tclIndexObj.c21
4 files changed, 19 insertions, 15 deletions
diff --git a/generic/tcl.h b/generic/tcl.h
index e6cc4be..274be35 100644
--- a/generic/tcl.h
+++ b/generic/tcl.h
@@ -977,15 +977,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/tclCompCmdsSZ.c b/generic/tclCompCmdsSZ.c
index 62909eb..a637786 100644
--- a/generic/tclCompCmdsSZ.c
+++ b/generic/tclCompCmdsSZ.c
@@ -2972,6 +2972,9 @@ TclCompileTryCmd(
goto failedToCompile;
}
finallyToken = TokenAfter(tokenPtr);
+ if (finallyToken->type != TCL_TOKEN_SIMPLE_WORD) {
+ goto failedToCompile;
+ }
} else {
goto failedToCompile;
}
diff --git a/generic/tclDecls.h b/generic/tclDecls.h
index db83005..7ac6849 100644
--- a/generic/tclDecls.h
+++ b/generic/tclDecls.h
@@ -4276,7 +4276,7 @@ extern const TclStubs *tclStubsPtr;
#define Tcl_GetBytesFromObj(interp, objPtr, sizePtr) \
(sizeof(*(sizePtr)) <= sizeof(int) ? tclStubsPtr->tclGetBytesFromObj(interp, objPtr, (int *)(sizePtr)) : tclStubsPtr->tcl_GetBytesFromObj(interp, 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)))
#ifdef TCL_NO_DEPRECATED
#define Tcl_GetStringFromObj(objPtr, sizePtr) \
(sizeof(*(sizePtr)) <= sizeof(int) ? tclStubsPtr->tcl_GetStringFromObj(objPtr, (int *)(sizePtr)) : tclStubsPtr->tclGetStringFromObj(objPtr, (size_t *)(sizePtr)))
@@ -4289,7 +4289,7 @@ extern const TclStubs *tclStubsPtr;
#define Tcl_GetBytesFromObj(interp, objPtr, sizePtr) \
(sizeof(*(sizePtr)) <= sizeof(int) ? (TclGetBytesFromObj)(interp, objPtr, (int *)(sizePtr)) : (Tcl_GetBytesFromObj)(interp, 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)))
#ifdef TCL_NO_DEPRECATED
#define Tcl_GetStringFromObj(objPtr, sizePtr) \
(sizeof(*(sizePtr)) <= sizeof(int) ? (Tcl_GetStringFromObj)(objPtr, (int *)(sizePtr)) : (TclGetStringFromObj)(objPtr, (size_t *)(sizePtr)))
diff --git a/generic/tclIndexObj.c b/generic/tclIndexObj.c
index 1f600c5..e1526ad 100644
--- a/generic/tclIndexObj.c
+++ b/generic/tclIndexObj.c
@@ -369,20 +369,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;
}