Skip to content

Commit ef8fe69

Browse files
committed
Remove useless casts to (void *)
Their presence causes (small) risks of hiding actual type mismatches or silently discarding qualifiers. Some have been missed in 7f798ac 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
1 parent 2aabaa5 commit ef8fe69

File tree

9 files changed

+9
-9
lines changed

9 files changed

+9
-9
lines changed

src/backend/catalog/pg_publication.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1369,7 +1369,7 @@ pg_get_publication_sequences(PG_FUNCTION_ARGS)
13691369
if (publication->allsequences)
13701370
sequences = GetAllPublicationRelations(RELKIND_SEQUENCE, false);
13711371

1372-
funcctx->user_fctx = (void *) sequences;
1372+
funcctx->user_fctx = sequences;
13731373

13741374
MemoryContextSwitchTo(oldcontext);
13751375
}

src/backend/commands/copyfromparse.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ CopyGetData(CopyFromState cstate, void *databuf, int minread, int maxread)
335335
if (avail > maxread)
336336
avail = maxread;
337337
pq_copymsgbytes(cstate->fe_msgbuf, databuf, avail);
338-
databuf = (void *) ((char *) databuf + avail);
338+
databuf = (char *) databuf + avail;
339339
maxread -= avail;
340340
bytesread += avail;
341341
}

src/backend/commands/extension.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -931,7 +931,7 @@ execute_sql_string(const char *sql, const char *filename)
931931
callback_arg.stmt_len = -1;
932932

933933
scripterrcontext.callback = script_error_callback;
934-
scripterrcontext.arg = (void *) &callback_arg;
934+
scripterrcontext.arg = &callback_arg;
935935
scripterrcontext.previous = error_context_stack;
936936
error_context_stack = &scripterrcontext;
937937

src/backend/storage/lmgr/lock.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1943,7 +1943,7 @@ WaitOnLock(LOCALLOCK *locallock, ResourceOwner owner)
19431943

19441944
/* Setup error traceback support for ereport() */
19451945
waiterrcontext.callback = waitonlock_error_callback;
1946-
waiterrcontext.arg = (void *) locallock;
1946+
waiterrcontext.arg = locallock;
19471947
waiterrcontext.previous = error_context_stack;
19481948
error_context_stack = &waiterrcontext;
19491949

src/backend/tsearch/wparser.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ prs_setup_firstcall(FuncCallContext *funcctx, FunctionCallInfo fcinfo,
204204
st->len = st->cur;
205205
st->cur = 0;
206206

207-
funcctx->user_fctx = (void *) st;
207+
funcctx->user_fctx = st;
208208
if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
209209
elog(ERROR, "return type must be a row type");
210210
funcctx->tuple_desc = tupdesc;

src/backend/utils/cache/inval.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1480,7 +1480,7 @@ CacheInvalidateHeapTupleCommon(Relation relation,
14801480
else
14811481
PrepareToInvalidateCacheTuple(relation, tuple, newtuple,
14821482
RegisterCatcacheInvalidation,
1483-
(void *) info);
1483+
info);
14841484

14851485
/*
14861486
* Now, is this tuple one of the primary definers of a relcache entry? See

src/backend/utils/misc/injection_point.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ injection_point_cache_load(InjectionPointEntry *entry, int slot_idx, uint64 gene
186186
elog(ERROR, "could not find library \"%s\" for injection point \"%s\"",
187187
path, entry->name);
188188

189-
injection_callback_local = (void *)
189+
injection_callback_local =
190190
load_external_function(path, entry->function, false, NULL);
191191

192192
if (injection_callback_local == NULL)

src/backend/utils/mmgr/bump.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ BumpAllocChunkFromBlock(MemoryContext context, BumpBlock *block, Size size,
407407
#ifdef MEMORY_CONTEXT_CHECKING
408408
chunk = (MemoryChunk *) block->freeptr;
409409
#else
410-
ptr = (void *) block->freeptr;
410+
ptr = block->freeptr;
411411
#endif
412412

413413
/* point the freeptr beyond this chunk */

src/backend/utils/sort/tuplesortvariants.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1954,7 +1954,7 @@ readtup_index_gin(Tuplesortstate *state, SortTuple *stup,
19541954
LogicalTapeReadExact(tape, tuple, tuplen);
19551955
if (base->sortopt & TUPLESORT_RANDOMACCESS) /* need trailing length word? */
19561956
LogicalTapeReadExact(tape, &tuplen, sizeof(tuplen));
1957-
stup->tuple = (void *) tuple;
1957+
stup->tuple = tuple;
19581958

19591959
/* no abbreviations (FIXME maybe use attrnum for this?) */
19601960
stup->datum1 = (Datum) 0;

0 commit comments

Comments
 (0)