1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-03 20:02:46 +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:
Tom Lane
2015-02-20 17:32:01 -05:00
parent c110eff132
commit 33a3b03d63
11 changed files with 32 additions and 37 deletions

View File

@ -122,8 +122,8 @@ typedef struct InvalidationChunk
struct InvalidationChunk *next; /* list link */
int nitems; /* # items currently stored in chunk */
int maxitems; /* size of allocated array in this chunk */
SharedInvalidationMessage msgs[1]; /* VARIABLE LENGTH ARRAY */
} InvalidationChunk; /* VARIABLE LENGTH STRUCTURE */
SharedInvalidationMessage msgs[FLEXIBLE_ARRAY_MEMBER];
} InvalidationChunk;
typedef struct InvalidationListHeader
{
@ -225,8 +225,8 @@ AddInvalidationMessage(InvalidationChunk **listHdr,
#define FIRSTCHUNKSIZE 32
chunk = (InvalidationChunk *)
MemoryContextAlloc(CurTransactionContext,
sizeof(InvalidationChunk) +
(FIRSTCHUNKSIZE - 1) *sizeof(SharedInvalidationMessage));
offsetof(InvalidationChunk, msgs) +
FIRSTCHUNKSIZE * sizeof(SharedInvalidationMessage));
chunk->nitems = 0;
chunk->maxitems = FIRSTCHUNKSIZE;
chunk->next = *listHdr;
@ -239,8 +239,8 @@ AddInvalidationMessage(InvalidationChunk **listHdr,
chunk = (InvalidationChunk *)
MemoryContextAlloc(CurTransactionContext,
sizeof(InvalidationChunk) +
(chunksize - 1) *sizeof(SharedInvalidationMessage));
offsetof(InvalidationChunk, msgs) +
chunksize * sizeof(SharedInvalidationMessage));
chunk->nitems = 0;
chunk->maxitems = chunksize;
chunk->next = *listHdr;

View File

@ -93,7 +93,7 @@ typedef struct TypeCacheEnumData
Oid bitmap_base; /* OID corresponding to bit 0 of bitmapset */
Bitmapset *sorted_values; /* Set of OIDs known to be in order */
int num_values; /* total number of values in enum */
EnumItem enum_values[1]; /* VARIABLE LENGTH ARRAY */
EnumItem enum_values[FLEXIBLE_ARRAY_MEMBER];
} TypeCacheEnumData;
/*