From c6ff0b892c30122b75d32c524109d16ee3c973f0 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Thu, 14 Mar 2019 13:30:09 +0100 Subject: Refactor ParamListInfo initialization There were six copies of identical nontrivial code. Put it into a function. --- src/backend/executor/functions.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) (limited to 'src/backend/executor/functions.c') diff --git a/src/backend/executor/functions.c b/src/backend/executor/functions.c index c6b7203f813..965e5dea70e 100644 --- a/src/backend/executor/functions.c +++ b/src/backend/executor/functions.c @@ -906,21 +906,10 @@ postquel_sub_params(SQLFunctionCachePtr fcache, if (nargs > 0) { ParamListInfo paramLI; - int i; if (fcache->paramLI == NULL) { - paramLI = (ParamListInfo) - palloc(offsetof(ParamListInfoData, params) + - nargs * sizeof(ParamExternData)); - /* we have static list of params, so no hooks needed */ - paramLI->paramFetch = NULL; - paramLI->paramFetchArg = NULL; - paramLI->paramCompile = NULL; - paramLI->paramCompileArg = NULL; - paramLI->parserSetup = NULL; - paramLI->parserSetupArg = NULL; - paramLI->numParams = nargs; + paramLI = makeParamList(nargs); fcache->paramLI = paramLI; } else @@ -929,7 +918,7 @@ postquel_sub_params(SQLFunctionCachePtr fcache, Assert(paramLI->numParams == nargs); } - for (i = 0; i < nargs; i++) + for (int i = 0; i < nargs; i++) { ParamExternData *prm = ¶mLI->params[i]; -- cgit v1.2.3