mirror of
https://git.postgresql.org/git/postgresql.git
synced 2025-01-24 18:55:04 +08:00
Use FLEXIBLE_ARRAY_MEMBER in struct RecordIOData.
I (tgl) fixed this last night in rowtypes.c, but I missed that the code had been copied into a couple of other places. Michael Paquier
This commit is contained in:
parent
e38b1eb098
commit
c110eff132
@ -747,7 +747,7 @@ typedef struct RecordIOData
|
||||
Oid record_type;
|
||||
int32 record_typmod;
|
||||
int ncolumns;
|
||||
ColumnIOData columns[1]; /* VARIABLE LENGTH ARRAY */
|
||||
ColumnIOData columns[FLEXIBLE_ARRAY_MEMBER];
|
||||
} RecordIOData;
|
||||
|
||||
PG_FUNCTION_INFO_V1(hstore_from_record);
|
||||
@ -805,8 +805,8 @@ hstore_from_record(PG_FUNCTION_ARGS)
|
||||
{
|
||||
fcinfo->flinfo->fn_extra =
|
||||
MemoryContextAlloc(fcinfo->flinfo->fn_mcxt,
|
||||
sizeof(RecordIOData) - sizeof(ColumnIOData)
|
||||
+ ncolumns * sizeof(ColumnIOData));
|
||||
offsetof(RecordIOData, columns) +
|
||||
ncolumns * sizeof(ColumnIOData));
|
||||
my_extra = (RecordIOData *) fcinfo->flinfo->fn_extra;
|
||||
my_extra->record_type = InvalidOid;
|
||||
my_extra->record_typmod = 0;
|
||||
@ -816,8 +816,8 @@ hstore_from_record(PG_FUNCTION_ARGS)
|
||||
my_extra->record_typmod != tupTypmod)
|
||||
{
|
||||
MemSet(my_extra, 0,
|
||||
sizeof(RecordIOData) - sizeof(ColumnIOData)
|
||||
+ ncolumns * sizeof(ColumnIOData));
|
||||
offsetof(RecordIOData, columns) +
|
||||
ncolumns * sizeof(ColumnIOData));
|
||||
my_extra->record_type = tupType;
|
||||
my_extra->record_typmod = tupTypmod;
|
||||
my_extra->ncolumns = ncolumns;
|
||||
@ -990,8 +990,8 @@ hstore_populate_record(PG_FUNCTION_ARGS)
|
||||
{
|
||||
fcinfo->flinfo->fn_extra =
|
||||
MemoryContextAlloc(fcinfo->flinfo->fn_mcxt,
|
||||
sizeof(RecordIOData) - sizeof(ColumnIOData)
|
||||
+ ncolumns * sizeof(ColumnIOData));
|
||||
offsetof(RecordIOData, columns) +
|
||||
ncolumns * sizeof(ColumnIOData));
|
||||
my_extra = (RecordIOData *) fcinfo->flinfo->fn_extra;
|
||||
my_extra->record_type = InvalidOid;
|
||||
my_extra->record_typmod = 0;
|
||||
@ -1001,8 +1001,8 @@ hstore_populate_record(PG_FUNCTION_ARGS)
|
||||
my_extra->record_typmod != tupTypmod)
|
||||
{
|
||||
MemSet(my_extra, 0,
|
||||
sizeof(RecordIOData) - sizeof(ColumnIOData)
|
||||
+ ncolumns * sizeof(ColumnIOData));
|
||||
offsetof(RecordIOData, columns) +
|
||||
ncolumns * sizeof(ColumnIOData));
|
||||
my_extra->record_type = tupType;
|
||||
my_extra->record_typmod = tupTypmod;
|
||||
my_extra->ncolumns = ncolumns;
|
||||
|
@ -216,7 +216,7 @@ typedef struct RecordIOData
|
||||
Oid record_type;
|
||||
int32 record_typmod;
|
||||
int ncolumns;
|
||||
ColumnIOData columns[1]; /* VARIABLE LENGTH ARRAY */
|
||||
ColumnIOData columns[FLEXIBLE_ARRAY_MEMBER];
|
||||
} RecordIOData;
|
||||
|
||||
/* state for populate_recordset */
|
||||
@ -2148,8 +2148,8 @@ populate_record_worker(FunctionCallInfo fcinfo, const char *funcname,
|
||||
{
|
||||
fcinfo->flinfo->fn_extra =
|
||||
MemoryContextAlloc(fcinfo->flinfo->fn_mcxt,
|
||||
sizeof(RecordIOData) - sizeof(ColumnIOData)
|
||||
+ ncolumns * sizeof(ColumnIOData));
|
||||
offsetof(RecordIOData, columns) +
|
||||
ncolumns * sizeof(ColumnIOData));
|
||||
my_extra = (RecordIOData *) fcinfo->flinfo->fn_extra;
|
||||
my_extra->record_type = InvalidOid;
|
||||
my_extra->record_typmod = 0;
|
||||
@ -2161,8 +2161,8 @@ populate_record_worker(FunctionCallInfo fcinfo, const char *funcname,
|
||||
my_extra->record_typmod != tupTypmod))
|
||||
{
|
||||
MemSet(my_extra, 0,
|
||||
sizeof(RecordIOData) - sizeof(ColumnIOData)
|
||||
+ ncolumns * sizeof(ColumnIOData));
|
||||
offsetof(RecordIOData, columns) +
|
||||
ncolumns * sizeof(ColumnIOData));
|
||||
my_extra->record_type = tupType;
|
||||
my_extra->record_typmod = tupTypmod;
|
||||
my_extra->ncolumns = ncolumns;
|
||||
@ -2653,8 +2653,8 @@ populate_recordset_worker(FunctionCallInfo fcinfo, const char *funcname,
|
||||
{
|
||||
fcinfo->flinfo->fn_extra =
|
||||
MemoryContextAlloc(fcinfo->flinfo->fn_mcxt,
|
||||
sizeof(RecordIOData) - sizeof(ColumnIOData)
|
||||
+ ncolumns * sizeof(ColumnIOData));
|
||||
offsetof(RecordIOData, columns) +
|
||||
ncolumns * sizeof(ColumnIOData));
|
||||
my_extra = (RecordIOData *) fcinfo->flinfo->fn_extra;
|
||||
my_extra->record_type = InvalidOid;
|
||||
my_extra->record_typmod = 0;
|
||||
@ -2664,8 +2664,8 @@ populate_recordset_worker(FunctionCallInfo fcinfo, const char *funcname,
|
||||
my_extra->record_typmod != tupTypmod)
|
||||
{
|
||||
MemSet(my_extra, 0,
|
||||
sizeof(RecordIOData) - sizeof(ColumnIOData)
|
||||
+ ncolumns * sizeof(ColumnIOData));
|
||||
offsetof(RecordIOData, columns) +
|
||||
ncolumns * sizeof(ColumnIOData));
|
||||
my_extra->record_type = tupType;
|
||||
my_extra->record_typmod = tupTypmod;
|
||||
my_extra->ncolumns = ncolumns;
|
||||
|
Loading…
Reference in New Issue
Block a user