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:
@ -3005,7 +3005,7 @@ typedef struct SetConstraintStateData
|
||||
bool all_isdeferred;
|
||||
int numstates; /* number of trigstates[] entries in use */
|
||||
int numalloc; /* allocated size of trigstates[] */
|
||||
SetConstraintTriggerData trigstates[1]; /* VARIABLE LENGTH ARRAY */
|
||||
SetConstraintTriggerData trigstates[FLEXIBLE_ARRAY_MEMBER];
|
||||
} SetConstraintStateData;
|
||||
|
||||
typedef SetConstraintStateData *SetConstraintState;
|
||||
@ -4398,8 +4398,8 @@ SetConstraintStateCreate(int numalloc)
|
||||
*/
|
||||
state = (SetConstraintState)
|
||||
MemoryContextAllocZero(TopTransactionContext,
|
||||
sizeof(SetConstraintStateData) +
|
||||
(numalloc - 1) *sizeof(SetConstraintTriggerData));
|
||||
offsetof(SetConstraintStateData, trigstates) +
|
||||
numalloc * sizeof(SetConstraintTriggerData));
|
||||
|
||||
state->numalloc = numalloc;
|
||||
|
||||
@ -4440,8 +4440,8 @@ SetConstraintStateAddItem(SetConstraintState state,
|
||||
newalloc = Max(newalloc, 8); /* in case original has size 0 */
|
||||
state = (SetConstraintState)
|
||||
repalloc(state,
|
||||
sizeof(SetConstraintStateData) +
|
||||
(newalloc - 1) *sizeof(SetConstraintTriggerData));
|
||||
offsetof(SetConstraintStateData, trigstates) +
|
||||
newalloc * sizeof(SetConstraintTriggerData));
|
||||
state->numalloc = newalloc;
|
||||
Assert(state->numstates < state->numalloc);
|
||||
}
|
||||
|
Reference in New Issue
Block a user