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

Remove useless casts to (void *)

Their presence causes (small) risks of hiding actual type mismatches
or silently discarding qualifiers.  Some have been missed in
7f798aca1d and some are new ones along the same lines.

Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/aR8Yv%2BuATLKbJCgI%40ip-10-97-1-34.eu-west-3.compute.internal
This commit is contained in:
Peter Eisentraut
2025-11-21 16:49:40 +01:00
parent 2aabaa52df
commit ef8fe69360
9 changed files with 9 additions and 9 deletions

View File

@@ -1369,7 +1369,7 @@ pg_get_publication_sequences(PG_FUNCTION_ARGS)
if (publication->allsequences) if (publication->allsequences)
sequences = GetAllPublicationRelations(RELKIND_SEQUENCE, false); sequences = GetAllPublicationRelations(RELKIND_SEQUENCE, false);
funcctx->user_fctx = (void *) sequences; funcctx->user_fctx = sequences;
MemoryContextSwitchTo(oldcontext); MemoryContextSwitchTo(oldcontext);
} }

View File

@@ -335,7 +335,7 @@ CopyGetData(CopyFromState cstate, void *databuf, int minread, int maxread)
if (avail > maxread) if (avail > maxread)
avail = maxread; avail = maxread;
pq_copymsgbytes(cstate->fe_msgbuf, databuf, avail); pq_copymsgbytes(cstate->fe_msgbuf, databuf, avail);
databuf = (void *) ((char *) databuf + avail); databuf = (char *) databuf + avail;
maxread -= avail; maxread -= avail;
bytesread += avail; bytesread += avail;
} }

View File

@@ -931,7 +931,7 @@ execute_sql_string(const char *sql, const char *filename)
callback_arg.stmt_len = -1; callback_arg.stmt_len = -1;
scripterrcontext.callback = script_error_callback; scripterrcontext.callback = script_error_callback;
scripterrcontext.arg = (void *) &callback_arg; scripterrcontext.arg = &callback_arg;
scripterrcontext.previous = error_context_stack; scripterrcontext.previous = error_context_stack;
error_context_stack = &scripterrcontext; error_context_stack = &scripterrcontext;

View File

@@ -1943,7 +1943,7 @@ WaitOnLock(LOCALLOCK *locallock, ResourceOwner owner)
/* Setup error traceback support for ereport() */ /* Setup error traceback support for ereport() */
waiterrcontext.callback = waitonlock_error_callback; waiterrcontext.callback = waitonlock_error_callback;
waiterrcontext.arg = (void *) locallock; waiterrcontext.arg = locallock;
waiterrcontext.previous = error_context_stack; waiterrcontext.previous = error_context_stack;
error_context_stack = &waiterrcontext; error_context_stack = &waiterrcontext;

View File

@@ -204,7 +204,7 @@ prs_setup_firstcall(FuncCallContext *funcctx, FunctionCallInfo fcinfo,
st->len = st->cur; st->len = st->cur;
st->cur = 0; st->cur = 0;
funcctx->user_fctx = (void *) st; funcctx->user_fctx = st;
if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE) if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
elog(ERROR, "return type must be a row type"); elog(ERROR, "return type must be a row type");
funcctx->tuple_desc = tupdesc; funcctx->tuple_desc = tupdesc;

View File

@@ -1480,7 +1480,7 @@ CacheInvalidateHeapTupleCommon(Relation relation,
else else
PrepareToInvalidateCacheTuple(relation, tuple, newtuple, PrepareToInvalidateCacheTuple(relation, tuple, newtuple,
RegisterCatcacheInvalidation, RegisterCatcacheInvalidation,
(void *) info); info);
/* /*
* Now, is this tuple one of the primary definers of a relcache entry? See * Now, is this tuple one of the primary definers of a relcache entry? See

View File

@@ -186,7 +186,7 @@ injection_point_cache_load(InjectionPointEntry *entry, int slot_idx, uint64 gene
elog(ERROR, "could not find library \"%s\" for injection point \"%s\"", elog(ERROR, "could not find library \"%s\" for injection point \"%s\"",
path, entry->name); path, entry->name);
injection_callback_local = (void *) injection_callback_local =
load_external_function(path, entry->function, false, NULL); load_external_function(path, entry->function, false, NULL);
if (injection_callback_local == NULL) if (injection_callback_local == NULL)

View File

@@ -407,7 +407,7 @@ BumpAllocChunkFromBlock(MemoryContext context, BumpBlock *block, Size size,
#ifdef MEMORY_CONTEXT_CHECKING #ifdef MEMORY_CONTEXT_CHECKING
chunk = (MemoryChunk *) block->freeptr; chunk = (MemoryChunk *) block->freeptr;
#else #else
ptr = (void *) block->freeptr; ptr = block->freeptr;
#endif #endif
/* point the freeptr beyond this chunk */ /* point the freeptr beyond this chunk */

View File

@@ -1954,7 +1954,7 @@ readtup_index_gin(Tuplesortstate *state, SortTuple *stup,
LogicalTapeReadExact(tape, tuple, tuplen); LogicalTapeReadExact(tape, tuple, tuplen);
if (base->sortopt & TUPLESORT_RANDOMACCESS) /* need trailing length word? */ if (base->sortopt & TUPLESORT_RANDOMACCESS) /* need trailing length word? */
LogicalTapeReadExact(tape, &tuplen, sizeof(tuplen)); LogicalTapeReadExact(tape, &tuplen, sizeof(tuplen));
stup->tuple = (void *) tuple; stup->tuple = tuple;
/* no abbreviations (FIXME maybe use attrnum for this?) */ /* no abbreviations (FIXME maybe use attrnum for this?) */
stup->datum1 = (Datum) 0; stup->datum1 = (Datum) 0;