mirror of
https://github.com/postgres/postgres.git
synced 2025-05-28 00:03:23 -04:00
Some more FLEXIBLE_ARRAY_MEMBER fixes.
This commit is contained in:
parent
33b2a2c97f
commit
f2874feb7c
@ -41,9 +41,8 @@ typedef struct
|
||||
int num_vars; /* number of plain Var tlist entries */
|
||||
bool has_ph_vars; /* are there PlaceHolderVar entries? */
|
||||
bool has_non_vars; /* are there other entries? */
|
||||
/* array of num_vars entries: */
|
||||
tlist_vinfo vars[1]; /* VARIABLE LENGTH ARRAY */
|
||||
} indexed_tlist; /* VARIABLE LENGTH STRUCT */
|
||||
tlist_vinfo vars[FLEXIBLE_ARRAY_MEMBER]; /* has num_vars entries */
|
||||
} indexed_tlist;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
@ -56,7 +56,12 @@ typedef struct BrinMetaPageData
|
||||
/* Definitions for revmap pages */
|
||||
typedef struct RevmapContents
|
||||
{
|
||||
ItemPointerData rm_tids[1]; /* really REVMAP_PAGE_MAXITEMS */
|
||||
/*
|
||||
* This array will fill all available space on the page. It should be
|
||||
* declared [FLEXIBLE_ARRAY_MEMBER], but for some reason you can't do that
|
||||
* in an otherwise-empty struct.
|
||||
*/
|
||||
ItemPointerData rm_tids[1];
|
||||
} RevmapContents;
|
||||
|
||||
#define REVMAP_CONTENT_SIZE \
|
||||
|
@ -130,6 +130,10 @@ typedef struct ReplicationSlot
|
||||
*/
|
||||
typedef struct ReplicationSlotCtlData
|
||||
{
|
||||
/*
|
||||
* This array should be declared [FLEXIBLE_ARRAY_MEMBER], but for some
|
||||
* reason you can't do that in an otherwise-empty struct.
|
||||
*/
|
||||
ReplicationSlot replication_slots[1];
|
||||
} ReplicationSlotCtlData;
|
||||
|
||||
|
@ -892,7 +892,8 @@ pqSaveMessageField(PGresult *res, char code, const char *value)
|
||||
|
||||
pfield = (PGMessageField *)
|
||||
pqResultAlloc(res,
|
||||
sizeof(PGMessageField) + strlen(value),
|
||||
offsetof(PGMessageField, contents) +
|
||||
strlen(value) + 1,
|
||||
TRUE);
|
||||
if (!pfield)
|
||||
return; /* out of memory? */
|
||||
|
@ -145,7 +145,7 @@ typedef struct pgMessageField
|
||||
{
|
||||
struct pgMessageField *next; /* list link */
|
||||
char code; /* field code */
|
||||
char contents[1]; /* field value (VARIABLE LENGTH) */
|
||||
char contents[FLEXIBLE_ARRAY_MEMBER]; /* value, nul-terminated */
|
||||
} PGMessageField;
|
||||
|
||||
/* Fields needed for notice handling */
|
||||
@ -637,7 +637,7 @@ extern void pq_reset_sigpipe(sigset_t *osigset, bool sigpipe_pending,
|
||||
* The SSL implementatation provides these functions (fe-secure-openssl.c)
|
||||
*/
|
||||
extern void pgtls_init_library(bool do_ssl, int do_crypto);
|
||||
extern int pgtls_init(PGconn *conn);
|
||||
extern int pgtls_init(PGconn *conn);
|
||||
extern PostgresPollingStatusType pgtls_open_client(PGconn *conn);
|
||||
extern void pgtls_close(PGconn *conn);
|
||||
extern ssize_t pgtls_read(PGconn *conn, void *ptr, size_t len);
|
||||
|
@ -97,7 +97,7 @@ plpgsql_ns_additem(int itemtype, int itemno, const char *name)
|
||||
/* first item added must be a label */
|
||||
Assert(ns_top != NULL || itemtype == PLPGSQL_NSTYPE_LABEL);
|
||||
|
||||
nse = palloc(sizeof(PLpgSQL_nsitem) + strlen(name));
|
||||
nse = palloc(offsetof(PLpgSQL_nsitem, name) +strlen(name) + 1);
|
||||
nse->itemtype = itemtype;
|
||||
nse->itemno = itemno;
|
||||
nse->prev = ns_top;
|
||||
|
@ -329,7 +329,7 @@ typedef struct PLpgSQL_nsitem
|
||||
int itemtype;
|
||||
int itemno;
|
||||
struct PLpgSQL_nsitem *prev;
|
||||
char name[1]; /* actually, as long as needed */
|
||||
char name[FLEXIBLE_ARRAY_MEMBER]; /* nul-terminated string */
|
||||
} PLpgSQL_nsitem;
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user