1
0
mirror of https://github.com/postgres/postgres.git synced 2025-09-03 15:22:11 +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

@@ -959,7 +959,7 @@ CopyFrom(CopyFromState cstate)
/* Set up callback to identify error line number */
errcallback.callback = CopyFromErrorCallback;
errcallback.arg = (void *) cstate;
errcallback.arg = cstate;
errcallback.previous = error_context_stack;
error_context_stack = &errcallback;

View File

@@ -1532,7 +1532,7 @@ ImportForeignSchema(ImportForeignSchemaStmt *stmt)
callback_arg.tablename = NULL; /* not known yet */
callback_arg.cmd = cmd;
sqlerrcontext.callback = import_error_callback;
sqlerrcontext.arg = (void *) &callback_arg;
sqlerrcontext.arg = &callback_arg;
sqlerrcontext.previous = error_context_stack;
error_context_stack = &sqlerrcontext;

View File

@@ -3344,7 +3344,7 @@ ReindexPartitions(const ReindexStmt *stmt, Oid relid, const ReindexParams *param
errinfo.relnamespace = pstrdup(relnamespace);
errinfo.relkind = relkind;
errcallback.callback = reindex_error_callback;
errcallback.arg = (void *) &errinfo;
errcallback.arg = &errinfo;
errcallback.previous = error_context_stack;
error_context_stack = &errcallback;

View File

@@ -54,7 +54,7 @@ LockTableCommand(LockStmt *lockstmt)
reloid = RangeVarGetRelidExtended(rv, lockstmt->mode,
lockstmt->nowait ? RVR_NOWAIT : 0,
RangeVarCallbackForLockTable,
(void *) &lockstmt->mode);
&lockstmt->mode);
if (get_rel_relkind(reloid) == RELKIND_VIEW)
LockViewRecurse(reloid, lockstmt->mode, lockstmt->nowait, NIL);

View File

@@ -627,7 +627,7 @@ CreatePolicy(CreatePolicyStmt *stmt)
table_id = RangeVarGetRelidExtended(stmt->table, AccessExclusiveLock,
0,
RangeVarCallbackForPolicy,
(void *) stmt);
stmt);
/* Open target_table to build quals. No additional lock is necessary. */
target_table = relation_open(table_id, NoLock);
@@ -803,7 +803,7 @@ AlterPolicy(AlterPolicyStmt *stmt)
table_id = RangeVarGetRelidExtended(stmt->table, AccessExclusiveLock,
0,
RangeVarCallbackForPolicy,
(void *) stmt);
stmt);
target_table = relation_open(table_id, NoLock);
@@ -1108,7 +1108,7 @@ rename_policy(RenameStmt *stmt)
table_id = RangeVarGetRelidExtended(stmt->relation, AccessExclusiveLock,
0,
RangeVarCallbackForPolicy,
(void *) stmt);
stmt);
target_table = relation_open(table_id, NoLock);

View File

@@ -256,7 +256,7 @@ contain_invalid_rfcolumn_walker(Node *node, rf_context *context)
}
return expression_tree_walker(node, contain_invalid_rfcolumn_walker,
(void *) context);
context);
}
/*
@@ -570,7 +570,7 @@ check_simple_rowfilter_expr_walker(Node *node, ParseState *pstate)
if (exprType(node) >= FirstNormalObjectId)
errdetail_msg = _("User-defined types are not allowed.");
else if (check_functions_in_node(node, contain_mutable_or_user_functions_checker,
(void *) pstate))
pstate))
errdetail_msg = _("User-defined or built-in mutable functions are not allowed.");
else if (exprCollation(node) >= FirstNormalObjectId ||
exprInputCollation(node) >= FirstNormalObjectId)
@@ -589,7 +589,7 @@ check_simple_rowfilter_expr_walker(Node *node, ParseState *pstate)
parser_errposition(pstate, exprLocation(node))));
return expression_tree_walker(node, check_simple_rowfilter_expr_walker,
(void *) pstate);
pstate);
}
/*

View File

@@ -1581,7 +1581,7 @@ RemoveRelations(DropStmt *drop)
relOid = RangeVarGetRelidExtended(rel, lockmode, RVR_MISSING_OK,
RangeVarCallbackForDropRelation,
(void *) &state);
&state);
/* Not there? */
if (!OidIsValid(relOid))
@@ -4142,7 +4142,7 @@ RenameRelation(RenameStmt *stmt)
relid = RangeVarGetRelidExtended(stmt->relation, lockmode,
stmt->missing_ok ? RVR_MISSING_OK : 0,
RangeVarCallbackForAlterRelation,
(void *) stmt);
stmt);
if (!OidIsValid(relid))
{
@@ -4390,7 +4390,7 @@ AlterTableLookupRelation(AlterTableStmt *stmt, LOCKMODE lockmode)
return RangeVarGetRelidExtended(stmt->relation, lockmode,
stmt->missing_ok ? RVR_MISSING_OK : 0,
RangeVarCallbackForAlterRelation,
(void *) stmt);
stmt);
}
/*
@@ -17719,7 +17719,7 @@ AlterTableNamespace(AlterObjectSchemaStmt *stmt, Oid *oldschema)
relid = RangeVarGetRelidExtended(stmt->relation, AccessExclusiveLock,
stmt->missing_ok ? RVR_MISSING_OK : 0,
RangeVarCallbackForAlterRelation,
(void *) stmt);
stmt);
if (!OidIsValid(relid))
{
@@ -20350,7 +20350,7 @@ ATExecAttachPartitionIdx(List **wqueue, Relation parentIdx, RangeVar *name)
partIdxId =
RangeVarGetRelidExtended(name, AccessExclusiveLock, 0,
RangeVarCallbackForAttachIndex,
(void *) &state);
&state);
/* Not there? */
if (!OidIsValid(partIdxId))
ereport(ERROR,

View File

@@ -1290,7 +1290,7 @@ check_temp_tablespaces(char **newval, void **extra, GucSource source)
return false;
myextra->numSpcs = numSpcs;
memcpy(myextra->tblSpcs, tblSpcs, numSpcs * sizeof(Oid));
*extra = (void *) myextra;
*extra = myextra;
pfree(tblSpcs);
}

View File

@@ -3562,7 +3562,7 @@ domainAddCheckConstraint(Oid domainOid, Oid domainNamespace, Oid baseTypeOid,
domVal->location = -1; /* will be set when/if used */
pstate->p_pre_columnref_hook = replace_domain_constraint_value;
pstate->p_ref_hook_state = (void *) domVal;
pstate->p_ref_hook_state = domVal;
expr = transformExpr(pstate, constr->raw_expr, EXPR_KIND_DOMAIN_CHECK);

View File

@@ -2518,7 +2518,7 @@ vac_bulkdel_one_index(IndexVacuumInfo *ivinfo, IndexBulkDeleteResult *istat,
{
/* Do bulk deletion */
istat = index_bulk_delete(ivinfo, istat, vac_tid_reaped,
(void *) dead_items);
dead_items);
ereport(ivinfo->message_level,
(errmsg("scanned index \"%s\" to remove %lld row versions",

View File

@@ -232,7 +232,7 @@ check_datestyle(char **newval, void **extra, GucSource source)
return false;
myextra[0] = newDateStyle;
myextra[1] = newDateOrder;
*extra = (void *) myextra;
*extra = myextra;
return true;
}
@@ -901,7 +901,7 @@ check_session_authorization(char **newval, void **extra, GucSource source)
return false;
myextra->roleid = roleid;
myextra->is_superuser = is_superuser;
*extra = (void *) myextra;
*extra = myextra;
return true;
}
@@ -1015,7 +1015,7 @@ check_role(char **newval, void **extra, GucSource source)
return false;
myextra->roleid = roleid;
myextra->is_superuser = is_superuser;
*extra = (void *) myextra;
*extra = myextra;
return true;
}