1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-24 09:27:52 +03:00

Remove useless casts to (void *)

Many of them just seem to have been copied around for no real reason.
Their presence causes (small) risks of hiding actual type mismatches
or silently discarding qualifiers

Discussion: https://www.postgresql.org/message-id/flat/461ea37c-8b58-43b4-9736-52884e862820@eisentraut.org
This commit is contained in:
Peter Eisentraut
2024-11-28 08:19:22 +01:00
parent 97525bc5c8
commit 7f798aca1d
158 changed files with 491 additions and 550 deletions

View File

@@ -2916,8 +2916,7 @@ expr_setup_walker(Node *node, ExprSetupInfo *info)
return false;
if (IsA(node, GroupingFunc))
return false;
return expression_tree_walker(node, expr_setup_walker,
(void *) info);
return expression_tree_walker(node, expr_setup_walker, info);
}
/*

View File

@@ -281,44 +281,44 @@ ExecReadyInterpretedExpr(ExprState *state)
if (step0 == EEOP_INNER_FETCHSOME &&
step1 == EEOP_INNER_VAR)
{
state->evalfunc_private = (void *) ExecJustInnerVar;
state->evalfunc_private = ExecJustInnerVar;
return;
}
else if (step0 == EEOP_OUTER_FETCHSOME &&
step1 == EEOP_OUTER_VAR)
{
state->evalfunc_private = (void *) ExecJustOuterVar;
state->evalfunc_private = ExecJustOuterVar;
return;
}
else if (step0 == EEOP_SCAN_FETCHSOME &&
step1 == EEOP_SCAN_VAR)
{
state->evalfunc_private = (void *) ExecJustScanVar;
state->evalfunc_private = ExecJustScanVar;
return;
}
else if (step0 == EEOP_INNER_FETCHSOME &&
step1 == EEOP_ASSIGN_INNER_VAR)
{
state->evalfunc_private = (void *) ExecJustAssignInnerVar;
state->evalfunc_private = ExecJustAssignInnerVar;
return;
}
else if (step0 == EEOP_OUTER_FETCHSOME &&
step1 == EEOP_ASSIGN_OUTER_VAR)
{
state->evalfunc_private = (void *) ExecJustAssignOuterVar;
state->evalfunc_private = ExecJustAssignOuterVar;
return;
}
else if (step0 == EEOP_SCAN_FETCHSOME &&
step1 == EEOP_ASSIGN_SCAN_VAR)
{
state->evalfunc_private = (void *) ExecJustAssignScanVar;
state->evalfunc_private = ExecJustAssignScanVar;
return;
}
else if (step0 == EEOP_CASE_TESTVAL &&
step1 == EEOP_FUNCEXPR_STRICT &&
state->steps[0].d.casetest.value)
{
state->evalfunc_private = (void *) ExecJustApplyFuncToCase;
state->evalfunc_private = ExecJustApplyFuncToCase;
return;
}
}
@@ -328,37 +328,37 @@ ExecReadyInterpretedExpr(ExprState *state)
if (step0 == EEOP_CONST)
{
state->evalfunc_private = (void *) ExecJustConst;
state->evalfunc_private = ExecJustConst;
return;
}
else if (step0 == EEOP_INNER_VAR)
{
state->evalfunc_private = (void *) ExecJustInnerVarVirt;
state->evalfunc_private = ExecJustInnerVarVirt;
return;
}
else if (step0 == EEOP_OUTER_VAR)
{
state->evalfunc_private = (void *) ExecJustOuterVarVirt;
state->evalfunc_private = ExecJustOuterVarVirt;
return;
}
else if (step0 == EEOP_SCAN_VAR)
{
state->evalfunc_private = (void *) ExecJustScanVarVirt;
state->evalfunc_private = ExecJustScanVarVirt;
return;
}
else if (step0 == EEOP_ASSIGN_INNER_VAR)
{
state->evalfunc_private = (void *) ExecJustAssignInnerVarVirt;
state->evalfunc_private = ExecJustAssignInnerVarVirt;
return;
}
else if (step0 == EEOP_ASSIGN_OUTER_VAR)
{
state->evalfunc_private = (void *) ExecJustAssignOuterVarVirt;
state->evalfunc_private = ExecJustAssignOuterVarVirt;
return;
}
else if (step0 == EEOP_ASSIGN_SCAN_VAR)
{
state->evalfunc_private = (void *) ExecJustAssignScanVarVirt;
state->evalfunc_private = ExecJustAssignScanVarVirt;
return;
}
}
@@ -379,7 +379,7 @@ ExecReadyInterpretedExpr(ExprState *state)
state->flags |= EEO_FLAG_DIRECT_THREADED;
#endif /* EEO_USE_COMPUTED_GOTO */
state->evalfunc_private = (void *) ExecInterpExpr;
state->evalfunc_private = ExecInterpExpr;
}
@@ -2226,7 +2226,7 @@ get_cached_rowtype(Oid type_id, int32 typmod,
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
errmsg("type %s is not composite",
format_type_be(type_id))));
rowcache->cacheptr = (void *) typentry;
rowcache->cacheptr = typentry;
rowcache->tupdesc_id = typentry->tupDesc_identifier;
if (changed)
*changed = true;
@@ -2251,7 +2251,7 @@ get_cached_rowtype(Oid type_id, int32 typmod,
tupDesc = lookup_rowtype_tupdesc(type_id, typmod);
/* Drop pin acquired by lookup_rowtype_tupdesc */
ReleaseTupleDesc(tupDesc);
rowcache->cacheptr = (void *) tupDesc;
rowcache->cacheptr = tupDesc;
rowcache->tupdesc_id = 0; /* not a valid value for non-RECORD */
if (changed)
*changed = true;

View File

@@ -1130,7 +1130,7 @@ index_expression_changed_walker(Node *node, Bitmapset *allUpdatedCols)
}
return expression_tree_walker(node, index_expression_changed_walker,
(void *) allUpdatedCols);
allUpdatedCols);
}
/*

View File

@@ -268,7 +268,7 @@ sql_fn_parser_setup(struct ParseState *pstate, SQLFunctionParseInfoPtr pinfo)
pstate->p_post_columnref_hook = sql_fn_post_column_ref;
pstate->p_paramref_hook = sql_fn_param_ref;
/* no need to use p_coerce_param_hook */
pstate->p_ref_hook_state = (void *) pinfo;
pstate->p_ref_hook_state = pinfo;
}
/*
@@ -614,7 +614,7 @@ init_sql_fcache(FunctionCallInfo fcinfo, Oid collation, bool lazyEvalOK)
*/
fcache = (SQLFunctionCachePtr) palloc0(sizeof(SQLFunctionCache));
fcache->fcontext = fcontext;
finfo->fn_extra = (void *) fcache;
finfo->fn_extra = fcache;
/*
* get the procedure tuple corresponding to the given function Oid

View File

@@ -1088,7 +1088,7 @@ finalize_aggregate(AggState *aggstate,
InitFunctionCallInfoData(*fcinfo, &peragg->finalfn,
numFinalArgs,
pertrans->aggCollation,
(void *) aggstate, NULL);
(Node *) aggstate, NULL);
/* Fill in the transition state value */
fcinfo->args[0].value =
@@ -1440,12 +1440,11 @@ find_cols_walker(Node *node, FindColsContext *context)
{
Assert(!context->is_aggref);
context->is_aggref = true;
expression_tree_walker(node, find_cols_walker, (void *) context);
expression_tree_walker(node, find_cols_walker, context);
context->is_aggref = false;
return false;
}
return expression_tree_walker(node, find_cols_walker,
(void *) context);
return expression_tree_walker(node, find_cols_walker, context);
}
/*
@@ -4101,7 +4100,7 @@ build_pertrans_for_aggref(AggStatePerTrans pertrans,
&pertrans->transfn,
numTransArgs,
pertrans->aggCollation,
(void *) aggstate, NULL);
(Node *) aggstate, NULL);
/* get info about the state value's datatype */
get_typlenbyval(aggtranstype,
@@ -4121,7 +4120,7 @@ build_pertrans_for_aggref(AggStatePerTrans pertrans,
&pertrans->serialfn,
1,
InvalidOid,
(void *) aggstate, NULL);
(Node *) aggstate, NULL);
}
if (OidIsValid(aggdeserialfn))
@@ -4137,7 +4136,7 @@ build_pertrans_for_aggref(AggStatePerTrans pertrans,
&pertrans->deserialfn,
2,
InvalidOid,
(void *) aggstate, NULL);
(Node *) aggstate, NULL);
}
/*

View File

@@ -122,7 +122,7 @@ ExecSort(PlanState *pstate)
tuplesortopts);
if (node->bounded)
tuplesort_set_bound(tuplesortstate, node->bound);
node->tuplesortstate = (void *) tuplesortstate;
node->tuplesortstate = tuplesortstate;
/*
* Scan the subplan and feed all the tuples to tuplesort using the

View File

@@ -339,7 +339,7 @@ advance_windowaggregate(WindowAggState *winstate,
InitFunctionCallInfoData(*fcinfo, &(peraggstate->transfn),
numArguments + 1,
perfuncstate->winCollation,
(void *) winstate, NULL);
(Node *) winstate, NULL);
fcinfo->args[0].value = peraggstate->transValue;
fcinfo->args[0].isnull = peraggstate->transValueIsNull;
winstate->curaggcontext = peraggstate->aggcontext;
@@ -510,7 +510,7 @@ advance_windowaggregate_base(WindowAggState *winstate,
InitFunctionCallInfoData(*fcinfo, &(peraggstate->invtransfn),
numArguments + 1,
perfuncstate->winCollation,
(void *) winstate, NULL);
(Node *) winstate, NULL);
fcinfo->args[0].value = peraggstate->transValue;
fcinfo->args[0].isnull = peraggstate->transValueIsNull;
winstate->curaggcontext = peraggstate->aggcontext;
@@ -601,7 +601,7 @@ finalize_windowaggregate(WindowAggState *winstate,
InitFunctionCallInfoData(fcinfodata.fcinfo, &(peraggstate->finalfn),
numFinalArgs,
perfuncstate->winCollation,
(void *) winstate, NULL);
(Node *) winstate, NULL);
fcinfo->args[0].value =
MakeExpandedObjectReadOnly(peraggstate->transValue,
peraggstate->transValueIsNull,
@@ -1047,7 +1047,7 @@ eval_windowfunction(WindowAggState *winstate, WindowStatePerFunc perfuncstate,
InitFunctionCallInfoData(*fcinfo, &(perfuncstate->flinfo),
perfuncstate->numArguments,
perfuncstate->winCollation,
(void *) perfuncstate->winobj, NULL);
(Node *) perfuncstate->winobj, NULL);
/* Just in case, make all the regular argument slots be null */
for (int argno = 0; argno < perfuncstate->numArguments; argno++)
fcinfo->args[argno].isnull = true;