8000 Improve style of two code paths · postgres/postgres@4572d59 · GitHub
[go: up one dir, main page]

Skip to content

Commit 4572d59

Browse files
committed
Improve style of two code paths
In execGrouping.c, execTuplesMatchPrepare() was doing a memory allocation that was not necessary when the number of columns was 0. In foreign.c, pg_options_to_table() was assigning twice a variable to the same value. Author: Ranier Vilela Discussion: https://postgr.es/m/CAEudQAqup0agbSzMjSLSTn=OANyCzxENF1+HrSYnr3WyZib7=Q@mail.gmail.com
1 parent a9ed7d9 commit 4572d59

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/backend/executor/execGrouping.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,15 @@ execTuplesMatchPrepare(TupleDesc desc,
6262
const Oid *collations,
6363
PlanState *parent)
6464
{
65-
Oid *eqFunctions = (Oid *) palloc(numCols * sizeof(Oid));
65+
Oid *eqFunctions;
6666
int i;
6767
ExprState *expr;
6868

6969
if (numCols == 0)
7070
return NULL;
7171

72+
eqFunctions = (Oid *) palloc(numCols * sizeof(Oid));
73+
7274
/* lookup equality functions */
7375
for (i = 0; i < numCols; i++)
7476
eqFunctions[i] = get_opcode(eqOperators[i]);

src/backend/foreign/foreign.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@ pg_options_to_table(PG_FUNCTION_ARGS)
524524
Datum array = PG_GETARG_DATUM(0);
525525
ListCell *cell;
526526
List *options;
527-
ReturnSetInfo *rsinfo = (ReturnSetInfo *) fcinfo->resultinfo;
527+
ReturnSetInfo *rsinfo;
528528

529529
options = untransformRelOptions(array);
530530
rsinfo = (ReturnSetInfo *) fcinfo->resultinfo;

0 commit comments

Comments
 (0)
0