mirror of
https://github.com/postgres/postgres.git
synced 2025-10-25 13:17:41 +03:00
Use FLEXIBLE_ARRAY_MEMBER for HeapTupleHeaderData.t_bits[].
This requires changing quite a few places that were depending on sizeof(HeapTupleHeaderData), but it seems for the best. Michael Paquier, some adjustments by me
This commit is contained in:
@@ -150,13 +150,15 @@ struct HeapTupleHeaderData
|
||||
|
||||
/* ^ - 23 bytes - ^ */
|
||||
|
||||
bits8 t_bits[1]; /* bitmap of NULLs -- VARIABLE LENGTH */
|
||||
bits8 t_bits[FLEXIBLE_ARRAY_MEMBER]; /* bitmap of NULLs */
|
||||
|
||||
/* MORE DATA FOLLOWS AT END OF STRUCT */
|
||||
};
|
||||
|
||||
/* typedef appears in tupbasics.h */
|
||||
|
||||
#define SizeofHeapTupleHeader offsetof(HeapTupleHeaderData, t_bits)
|
||||
|
||||
/*
|
||||
* information stored in t_infomask:
|
||||
*/
|
||||
@@ -498,7 +500,7 @@ do { \
|
||||
* you can, say, fit 2 tuples of size MaxHeapTupleSize/2 on the same page.
|
||||
*/
|
||||
#define MaxHeapTupleSize (BLCKSZ - MAXALIGN(SizeOfPageHeaderData + sizeof(ItemIdData)))
|
||||
#define MinHeapTupleSize MAXALIGN(offsetof(HeapTupleHeaderData, t_bits))
|
||||
#define MinHeapTupleSize MAXALIGN(SizeofHeapTupleHeader)
|
||||
|
||||
/*
|
||||
* MaxHeapTuplesPerPage is an upper bound on the number of tuples that can
|
||||
@@ -513,7 +515,7 @@ do { \
|
||||
*/
|
||||
#define MaxHeapTuplesPerPage \
|
||||
((int) ((BLCKSZ - SizeOfPageHeaderData) / \
|
||||
(MAXALIGN(offsetof(HeapTupleHeaderData, t_bits)) + sizeof(ItemIdData))))
|
||||
(MAXALIGN(SizeofHeapTupleHeader) + sizeof(ItemIdData))))
|
||||
|
||||
/*
|
||||
* MaxAttrSize is a somewhat arbitrary upper limit on the declared size of
|
||||
@@ -579,13 +581,15 @@ struct MinimalTupleData
|
||||
|
||||
/* ^ - 23 bytes - ^ */
|
||||
|
||||
bits8 t_bits[1]; /* bitmap of NULLs -- VARIABLE LENGTH */
|
||||
bits8 t_bits[FLEXIBLE_ARRAY_MEMBER]; /* bitmap of NULLs */
|
||||
|
||||
/* MORE DATA FOLLOWS AT END OF STRUCT */
|
||||
};
|
||||
|
||||
/* typedef appears in htup.h */
|
||||
|
||||
#define SizeofMinimalTupleHeader offsetof(MinimalTupleData, t_bits)
|
||||
|
||||
|
||||
/*
|
||||
* GETSTRUCT - given a HeapTuple pointer, return address of the user data
|
||||
|
||||
@@ -90,7 +90,7 @@
|
||||
|
||||
#define TOAST_MAX_CHUNK_SIZE \
|
||||
(EXTERN_TUPLE_MAX_SIZE - \
|
||||
MAXALIGN(offsetof(HeapTupleHeaderData, t_bits)) - \
|
||||
MAXALIGN(SizeofHeapTupleHeader) - \
|
||||
sizeof(Oid) - \
|
||||
sizeof(int32) - \
|
||||
VARHDRSZ)
|
||||
|
||||
Reference in New Issue
Block a user