mirror of
https://github.com/postgres/postgres.git
synced 2025-11-13 16:22:44 +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:
@@ -1836,7 +1836,7 @@ typedef struct BTVacInfo
|
||||
BTCycleId cycle_ctr; /* cycle ID most recently assigned */
|
||||
int num_vacuums; /* number of currently active VACUUMs */
|
||||
int max_vacuums; /* allocated length of vacuums[] array */
|
||||
BTOneVacInfo vacuums[1]; /* VARIABLE LENGTH ARRAY */
|
||||
BTOneVacInfo vacuums[FLEXIBLE_ARRAY_MEMBER];
|
||||
} BTVacInfo;
|
||||
|
||||
static BTVacInfo *btvacinfo;
|
||||
@@ -1984,7 +1984,7 @@ BTreeShmemSize(void)
|
||||
{
|
||||
Size size;
|
||||
|
||||
size = offsetof(BTVacInfo, vacuums[0]);
|
||||
size = offsetof(BTVacInfo, vacuums);
|
||||
size = add_size(size, mul_size(MaxBackends, sizeof(BTOneVacInfo)));
|
||||
return size;
|
||||
}
|
||||
|
||||
@@ -258,7 +258,7 @@ typedef struct MultiXactStateData
|
||||
* stored in pg_control and used as truncation point for pg_multixact. At
|
||||
* checkpoint or restartpoint, unneeded segments are removed.
|
||||
*/
|
||||
MultiXactId perBackendXactIds[1]; /* VARIABLE LENGTH ARRAY */
|
||||
MultiXactId perBackendXactIds[FLEXIBLE_ARRAY_MEMBER];
|
||||
} MultiXactStateData;
|
||||
|
||||
/*
|
||||
@@ -1744,8 +1744,9 @@ MultiXactShmemSize(void)
|
||||
{
|
||||
Size size;
|
||||
|
||||
/* We need 2*MaxOldestSlot + 1 perBackendXactIds[] entries */
|
||||
#define SHARED_MULTIXACT_STATE_SIZE \
|
||||
add_size(sizeof(MultiXactStateData), \
|
||||
add_size(offsetof(MultiXactStateData, perBackendXactIds) + sizeof(MultiXactId), \
|
||||
mul_size(sizeof(MultiXactId) * 2, MaxOldestSlot))
|
||||
|
||||
size = SHARED_MULTIXACT_STATE_SIZE;
|
||||
|
||||
@@ -134,12 +134,9 @@ typedef struct TwoPhaseStateData
|
||||
/* Number of valid prepXacts entries. */
|
||||
int numPrepXacts;
|
||||
|
||||
/*
|
||||
* There are max_prepared_xacts items in this array, but C wants a
|
||||
* fixed-size array.
|
||||
*/
|
||||
GlobalTransaction prepXacts[1]; /* VARIABLE LENGTH ARRAY */
|
||||
} TwoPhaseStateData; /* VARIABLE LENGTH STRUCT */
|
||||
/* There are max_prepared_xacts items in this array */
|
||||
GlobalTransaction prepXacts[FLEXIBLE_ARRAY_MEMBER];
|
||||
} TwoPhaseStateData;
|
||||
|
||||
static TwoPhaseStateData *TwoPhaseState;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user