mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-12-27 08:39:28 +08:00
Some more FLEXIBLE_ARRAY_MEMBER hacking.
This commit is contained in:
parent
9aa53bbd15
commit
5740be6d6e
@ -43,7 +43,7 @@ typedef struct RecordIOData
|
||||
Oid record_type;
|
||||
int32 record_typmod;
|
||||
int ncolumns;
|
||||
ColumnIOData columns[1]; /* VARIABLE LENGTH ARRAY */
|
||||
ColumnIOData columns[FLEXIBLE_ARRAY_MEMBER];
|
||||
} RecordIOData;
|
||||
|
||||
/*
|
||||
@ -61,7 +61,7 @@ typedef struct RecordCompareData
|
||||
int32 record1_typmod;
|
||||
Oid record2_type;
|
||||
int32 record2_typmod;
|
||||
ColumnCompareData columns[1]; /* VARIABLE LENGTH ARRAY */
|
||||
ColumnCompareData columns[FLEXIBLE_ARRAY_MEMBER];
|
||||
} RecordCompareData;
|
||||
|
||||
|
||||
@ -120,8 +120,8 @@ record_in(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;
|
||||
@ -131,8 +131,8 @@ record_in(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;
|
||||
@ -334,8 +334,8 @@ record_out(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;
|
||||
@ -345,8 +345,8 @@ record_out(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;
|
||||
@ -489,8 +489,8 @@ record_recv(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;
|
||||
@ -500,8 +500,8 @@ record_recv(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;
|
||||
@ -677,8 +677,8 @@ record_send(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;
|
||||
@ -688,8 +688,8 @@ record_send(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;
|
||||
@ -829,8 +829,8 @@ record_cmp(FunctionCallInfo fcinfo)
|
||||
{
|
||||
fcinfo->flinfo->fn_extra =
|
||||
MemoryContextAlloc(fcinfo->flinfo->fn_mcxt,
|
||||
sizeof(RecordCompareData) - sizeof(ColumnCompareData)
|
||||
+ ncols * sizeof(ColumnCompareData));
|
||||
offsetof(RecordCompareData, columns) +
|
||||
ncols * sizeof(ColumnCompareData));
|
||||
my_extra = (RecordCompareData *) fcinfo->flinfo->fn_extra;
|
||||
my_extra->ncolumns = ncols;
|
||||
my_extra->record1_type = InvalidOid;
|
||||
@ -1065,8 +1065,8 @@ record_eq(PG_FUNCTION_ARGS)
|
||||
{
|
||||
fcinfo->flinfo->fn_extra =
|
||||
MemoryContextAlloc(fcinfo->flinfo->fn_mcxt,
|
||||
sizeof(RecordCompareData) - sizeof(ColumnCompareData)
|
||||
+ ncols * sizeof(ColumnCompareData));
|
||||
offsetof(RecordCompareData, columns) +
|
||||
ncols * sizeof(ColumnCompareData));
|
||||
my_extra = (RecordCompareData *) fcinfo->flinfo->fn_extra;
|
||||
my_extra->ncolumns = ncols;
|
||||
my_extra->record1_type = InvalidOid;
|
||||
@ -1324,8 +1324,8 @@ record_image_cmp(FunctionCallInfo fcinfo)
|
||||
{
|
||||
fcinfo->flinfo->fn_extra =
|
||||
MemoryContextAlloc(fcinfo->flinfo->fn_mcxt,
|
||||
sizeof(RecordCompareData) - sizeof(ColumnCompareData)
|
||||
+ ncols * sizeof(ColumnCompareData));
|
||||
offsetof(RecordCompareData, columns) +
|
||||
ncols * sizeof(ColumnCompareData));
|
||||
my_extra = (RecordCompareData *) fcinfo->flinfo->fn_extra;
|
||||
my_extra->ncolumns = ncols;
|
||||
my_extra->record1_type = InvalidOid;
|
||||
@ -1601,8 +1601,8 @@ record_image_eq(PG_FUNCTION_ARGS)
|
||||
{
|
||||
fcinfo->flinfo->fn_extra =
|
||||
MemoryContextAlloc(fcinfo->flinfo->fn_mcxt,
|
||||
sizeof(RecordCompareData) - sizeof(ColumnCompareData)
|
||||
+ ncols * sizeof(ColumnCompareData));
|
||||
offsetof(RecordCompareData, columns) +
|
||||
ncols * sizeof(ColumnCompareData));
|
||||
my_extra = (RecordCompareData *) fcinfo->flinfo->fn_extra;
|
||||
my_extra->ncolumns = ncols;
|
||||
my_extra->record1_type = InvalidOid;
|
||||
|
Loading…
Reference in New Issue
Block a user