mirror of
https://github.com/postgres/postgres.git
synced 2025-06-30 21:42:05 +03:00
Use FLEXIBLE_ARRAY_MEMBER in some more places.
Fix a batch of structs that are only visible within individual .c files. Michael Paquier
This commit is contained in:
@ -297,9 +297,9 @@ typedef struct AggHashEntryData *AggHashEntry;
|
||||
typedef struct AggHashEntryData
|
||||
{
|
||||
TupleHashEntryData shared; /* common header for hash table entries */
|
||||
/* per-aggregate transition status array - must be last! */
|
||||
AggStatePerGroupData pergroup[1]; /* VARIABLE LENGTH ARRAY */
|
||||
} AggHashEntryData; /* VARIABLE LENGTH STRUCT */
|
||||
/* per-aggregate transition status array */
|
||||
AggStatePerGroupData pergroup[FLEXIBLE_ARRAY_MEMBER];
|
||||
} AggHashEntryData;
|
||||
|
||||
|
||||
static void initialize_aggregates(AggState *aggstate,
|
||||
@ -941,8 +941,8 @@ build_hash_table(AggState *aggstate)
|
||||
Assert(node->aggstrategy == AGG_HASHED);
|
||||
Assert(node->numGroups > 0);
|
||||
|
||||
entrysize = sizeof(AggHashEntryData) +
|
||||
(aggstate->numaggs - 1) * sizeof(AggStatePerGroupData);
|
||||
entrysize = offsetof(AggHashEntryData, pergroup) +
|
||||
aggstate->numaggs * sizeof(AggStatePerGroupData);
|
||||
|
||||
aggstate->hashtable = BuildTupleHashTable(node->numCols,
|
||||
node->grpColIdx,
|
||||
@ -1013,8 +1013,8 @@ hash_agg_entry_size(int numAggs)
|
||||
Size entrysize;
|
||||
|
||||
/* This must match build_hash_table */
|
||||
entrysize = sizeof(AggHashEntryData) +
|
||||
(numAggs - 1) * sizeof(AggStatePerGroupData);
|
||||
entrysize = offsetof(AggHashEntryData, pergroup) +
|
||||
numAggs * sizeof(AggStatePerGroupData);
|
||||
entrysize = MAXALIGN(entrysize);
|
||||
/* Account for hashtable overhead (assuming fill factor = 1) */
|
||||
entrysize += 3 * sizeof(void *);
|
||||
|
Reference in New Issue
Block a user