diff options
author | Peter Eisentraut <peter_e@gmx.net> | 2017-09-07 12:06:23 -0400 |
---|---|---|
committer | Peter Eisentraut <peter_e@gmx.net> | 2017-09-07 13:56:09 -0400 |
commit | 1356f78ea93395c107cbc75dc923e29a0efccd8a (patch) | |
tree | a06cc9e40efdf8382692fb79b5b22c3920f93b5f /src/backend/executor/execExprInterp.c | |
parent | 9d71323daca412e6e175595e1e42809fb5e1172d (diff) | |
download | postgresql-1356f78ea93395c107cbc75dc923e29a0efccd8a.tar.gz postgresql-1356f78ea93395c107cbc75dc923e29a0efccd8a.zip |
Reduce excessive dereferencing of function pointers
It is equivalent in ANSI C to write (*funcptr) () and funcptr(). These
two styles have been applied inconsistently. After discussion, we'll
use the more verbose style for plain function pointer variables, to make
it clear that it's a variable, and the shorter style when the function
pointer is in a struct (s.func() or s->func()), because then it's clear
that it's not a plain function name, and otherwise the excessive
punctuation makes some of those invocations hard to read.
Discussion: https://www.postgresql.org/message-id/f52c16db-14ed-757d-4b48-7ef360b1631d@2ndquadrant.com
Diffstat (limited to 'src/backend/executor/execExprInterp.c')
-rw-r--r-- | src/backend/executor/execExprInterp.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/backend/executor/execExprInterp.c b/src/backend/executor/execExprInterp.c index 83e04471e47..bd8a15d6c31 100644 --- a/src/backend/executor/execExprInterp.c +++ b/src/backend/executor/execExprInterp.c @@ -647,7 +647,7 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull) FunctionCallInfo fcinfo = op->d.func.fcinfo_data; fcinfo->isnull = false; - *op->resvalue = (op->d.func.fn_addr) (fcinfo); + *op->resvalue = op->d.func.fn_addr(fcinfo); *op->resnull = fcinfo->isnull; EEO_NEXT(); @@ -669,7 +669,7 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull) } } fcinfo->isnull = false; - *op->resvalue = (op->d.func.fn_addr) (fcinfo); + *op->resvalue = op->d.func.fn_addr(fcinfo); *op->resnull = fcinfo->isnull; strictfail: @@ -684,7 +684,7 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull) pgstat_init_function_usage(fcinfo, &fcusage); fcinfo->isnull = false; - *op->resvalue = (op->d.func.fn_addr) (fcinfo); + *op->resvalue = op->d.func.fn_addr(fcinfo); *op->resnull = fcinfo->isnull; pgstat_end_function_usage(&fcusage, true); @@ -712,7 +712,7 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull) pgstat_init_function_usage(fcinfo, &fcusage); fcinfo->isnull = false; - *op->resvalue = (op->d.func.fn_addr) (fcinfo); + *op->resvalue = op->d.func.fn_addr(fcinfo); *op->resnull = fcinfo->isnull; pgstat_end_function_usage(&fcusage, true); @@ -1170,7 +1170,7 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull) Datum eqresult; fcinfo->isnull = false; - eqresult = (op->d.func.fn_addr) (fcinfo); + eqresult = op->d.func.fn_addr(fcinfo); /* Must invert result of "="; safe to do even if null */ *op->resvalue = BoolGetDatum(!DatumGetBool(eqresult)); *op->resnull = fcinfo->isnull; @@ -1192,7 +1192,7 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull) Datum result; fcinfo->isnull = false; - result = (op->d.func.fn_addr) (fcinfo); + result = op->d.func.fn_addr(fcinfo); /* if the arguments are equal return null */ if (!fcinfo->isnull && DatumGetBool(result)) @@ -1279,7 +1279,7 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull) /* Apply comparison function */ fcinfo->isnull = false; - *op->resvalue = (op->d.rowcompare_step.fn_addr) (fcinfo); + *op->resvalue = op->d.rowcompare_step.fn_addr(fcinfo); /* force NULL result if NULL function result */ if (fcinfo->isnull) @@ -1878,7 +1878,7 @@ ExecEvalParamExtern(ExprState *state, ExprEvalStep *op, ExprContext *econtext) /* give hook a chance in case parameter is dynamic */ if (!OidIsValid(prm->ptype) && paramInfo->paramFetch != NULL) - (*paramInfo->paramFetch) (paramInfo, paramId); + paramInfo->paramFetch(paramInfo, paramId); if (likely(OidIsValid(prm->ptype))) { @@ -3000,7 +3000,7 @@ ExecEvalScalarArrayOp(ExprState *state, ExprEvalStep *op) else { fcinfo->isnull = false; - thisresult = (op->d.scalararrayop.fn_addr) (fcinfo); + thisresult = op->d.scalararrayop.fn_addr(fcinfo); } /* Combine results per OR or AND semantics */ |