summaryrefslogtreecommitdiffstats
path: root/generic/tclInt.h
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2022-07-13 13:17:45 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2022-07-13 13:17:45 (GMT)
commit1cf5b65db2236740af2398171de2259c12a7f878 (patch)
tree5893893ecdb33e81081752704ff981f3ba416909 /generic/tclInt.h
parent2f414ecd74af2a479bc87536dfd5c06119e8b6ec (diff)
parent037f0d4f7e7b70aaa44f11a934ed52c0fabca0b3 (diff)
downloadtcl-1cf5b65db2236740af2398171de2259c12a7f878.zip
tcl-1cf5b65db2236740af2398171de2259c12a7f878.tar.gz
tcl-1cf5b65db2236740af2398171de2259c12a7f878.tar.bz2
Merge 8.7 (Make ListStore->slots a TCLFLEXARRAY)
Diffstat (limited to 'generic/tclInt.h')
-rw-r--r--generic/tclInt.h7
1 files changed, 3 insertions, 4 deletions
diff --git a/generic/tclInt.h b/generic/tclInt.h
index 405585c..b892a7b 100644
--- a/generic/tclInt.h
+++ b/generic/tclInt.h
@@ -2476,7 +2476,7 @@ typedef struct ListStore {
ListSizeT numAllocated; /* Total number of slots[] array slots. */
int refCount; /* Number of references to this instance */
int flags; /* LISTSTORE_* flags */
- Tcl_Obj *slots[1]; /* Variable size array. Grown as needed */
+ Tcl_Obj *slots[TCLFLEXARRAY]; /* Variable size array. Grown as needed */
} ListStore;
#define LISTSTORE_CANONICAL 0x1 /* All Tcl_Obj's referencing this
@@ -2485,12 +2485,11 @@ typedef struct ListStore {
/* Max number of elements that can be contained in a list */
#define LIST_MAX \
- (1 \
- + (ListSizeT)(((size_t)ListSizeT_MAX - sizeof(ListStore)) \
+ ((ListSizeT)(((size_t)ListSizeT_MAX - offsetof(ListStore, slots)) \
/ sizeof(Tcl_Obj *)))
/* Memory size needed for a ListStore to hold numSlots_ elements */
#define LIST_SIZE(numSlots_) \
- (unsigned)(sizeof(ListStore) + (((numSlots_) - 1) * sizeof(Tcl_Obj *)))
+ ((int)(offsetof(ListStore, slots) + ((numSlots_) * sizeof(Tcl_Obj *))))
/*
* ListSpan --