aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/sort/sortsupport.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/utils/sort/sortsupport.c')
-rw-r--r--src/backend/utils/sort/sortsupport.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/backend/utils/sort/sortsupport.c b/src/backend/utils/sort/sortsupport.c
index e2100da266a..9a771214dc2 100644
--- a/src/backend/utils/sort/sortsupport.c
+++ b/src/backend/utils/sort/sortsupport.c
@@ -26,16 +26,17 @@
/* Info needed to use an old-style comparison function as a sort comparator */
typedef struct
{
- FunctionCallInfoData fcinfo; /* reusable callinfo structure */
FmgrInfo flinfo; /* lookup data for comparison function */
+ FunctionCallInfoBaseData fcinfo; /* reusable callinfo structure */
} SortShimExtra;
+#define SizeForSortShimExtra(nargs) (offsetof(SortShimExtra, fcinfo) + SizeForFunctionCallInfo(nargs))
/*
* Shim function for calling an old-style comparator
*
* This is essentially an inlined version of FunctionCall2Coll(), except
- * we assume that the FunctionCallInfoData was already mostly set up by
+ * we assume that the FunctionCallInfoBaseData was already mostly set up by
* PrepareSortSupportComparisonShim.
*/
static int
@@ -44,8 +45,8 @@ comparison_shim(Datum x, Datum y, SortSupport ssup)
SortShimExtra *extra = (SortShimExtra *) ssup->ssup_extra;
Datum result;
- extra->fcinfo.arg[0] = x;
- extra->fcinfo.arg[1] = y;
+ extra->fcinfo.args[0].value = x;
+ extra->fcinfo.args[1].value = y;
/* just for paranoia's sake, we reset isnull each time */
extra->fcinfo.isnull = false;
@@ -69,7 +70,7 @@ PrepareSortSupportComparisonShim(Oid cmpFunc, SortSupport ssup)
SortShimExtra *extra;
extra = (SortShimExtra *) MemoryContextAlloc(ssup->ssup_cxt,
- sizeof(SortShimExtra));
+ SizeForSortShimExtra(2));
/* Lookup the comparison function */
fmgr_info_cxt(cmpFunc, &extra->flinfo, ssup->ssup_cxt);
@@ -77,8 +78,8 @@ PrepareSortSupportComparisonShim(Oid cmpFunc, SortSupport ssup)
/* We can initialize the callinfo just once and re-use it */
InitFunctionCallInfoData(extra->fcinfo, &extra->flinfo, 2,
ssup->ssup_collation, NULL, NULL);
- extra->fcinfo.argnull[0] = false;
- extra->fcinfo.argnull[1] = false;
+ extra->fcinfo.args[0].isnull = false;
+ extra->fcinfo.args[1].isnull = false;
ssup->ssup_extra = extra;
ssup->comparator = comparison_shim;