1
0
mirror of https://github.com/postgres/postgres.git synced 2025-09-06 13:46:51 +03:00

Use FLEXIBLE_ARRAY_MEMBER in a number of other places.

I think we're about done with this...
This commit is contained in:
Tom Lane
2015-02-21 16:12:14 -05:00
parent e1a11d9311
commit 2e211211a7
14 changed files with 54 additions and 62 deletions

View File

@@ -93,7 +93,7 @@ typedef struct BufferAccessStrategyData
* simplicity this is palloc'd together with the fixed fields of the
* struct.
*/
Buffer buffers[1]; /* VARIABLE SIZE ARRAY */
Buffer buffers[FLEXIBLE_ARRAY_MEMBER];
} BufferAccessStrategyData;

View File

@@ -184,12 +184,9 @@ typedef struct SISeg
SharedInvalidationMessage buffer[MAXNUMMESSAGES];
/*
* Per-backend state info.
*
* We declare procState as 1 entry because C wants a fixed-size array, but
* actually it is maxBackends entries long.
* Per-backend invalidation state info (has MaxBackends entries).
*/
ProcState procState[1]; /* reflects the invalidation state */
ProcState procState[FLEXIBLE_ARRAY_MEMBER];
} SISeg;
static SISeg *shmInvalBuffer; /* pointer to the shared inval buffer */
@@ -221,16 +218,12 @@ SInvalShmemSize(void)
void
CreateSharedInvalidationState(void)
{
Size size;
int i;
bool found;
/* Allocate space in shared memory */
size = offsetof(SISeg, procState);
size = add_size(size, mul_size(sizeof(ProcState), MaxBackends));
shmInvalBuffer = (SISeg *)
ShmemInitStruct("shmInvalBuffer", size, &found);
ShmemInitStruct("shmInvalBuffer", SInvalShmemSize(), &found);
if (found)
return;