summaryrefslogtreecommitdiff
path: root/src/backend/executor/spi.c
diff options
context:
space:
mode:
authorPeter Eisentraut <peter@eisentraut.org>2019-03-14 13:30:09 +0100
committerPeter Eisentraut <peter@eisentraut.org>2019-03-14 13:30:09 +0100
commitc6ff0b892c30122b75d32c524109d16ee3c973f0 (patch)
treec01cf8fe3258deb6a28af5e7d28a4ea81eda6077 /src/backend/executor/spi.c
parent1226d932b4dadc39ba2f9a488e4d784443ea6a78 (diff)
Refactor ParamListInfo initialization
There were six copies of identical nontrivial code. Put it into a function.
Diffstat (limited to 'src/backend/executor/spi.c')
-rw-r--r--src/backend/executor/spi.c17
1 files changed, 3 insertions, 14 deletions
diff --git a/src/backend/executor/spi.c b/src/backend/executor/spi.c
index 70c03e0f605..d898f4ca78d 100644
--- a/src/backend/executor/spi.c
+++ b/src/backend/executor/spi.c
@@ -2387,20 +2387,9 @@ _SPI_convert_params(int nargs, Oid *argtypes,
if (nargs > 0)
{
- int i;
-
- 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;
-
- for (i = 0; i < nargs; i++)
+ paramLI = makeParamList(nargs);
+
+ for (int i = 0; i < nargs; i++)
{
ParamExternData *prm = &paramLI->params[i];