1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-27 23:21:58 +03:00

Refactor ParamListInfo initialization

There were six copies of identical nontrivial code.  Put it into a
function.
This commit is contained in:
Peter Eisentraut
2019-03-14 13:30:09 +01:00
parent 1226d932b4
commit c6ff0b892c
7 changed files with 39 additions and 77 deletions

View File

@ -2387,20 +2387,9 @@ _SPI_convert_params(int nargs, Oid *argtypes,
if (nargs > 0)
{
int i;
paramLI = makeParamList(nargs);
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++)
for (int i = 0; i < nargs; i++)
{
ParamExternData *prm = &paramLI->params[i];