1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-19 13:42:17 +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

@@ -664,7 +664,7 @@ tuplesort_puttupleslot(Tuplesortstate *state, TupleTableSlot *slot)
/* copy the tuple into sort storage */
tuple = ExecCopySlotMinimalTuple(slot);
stup.tuple = (void *) tuple;
stup.tuple = tuple;
/* set up first-column key value */
htup.t_len = tuple->t_len + MINIMAL_TUPLE_OFFSET;
htup.t_data = (HeapTupleHeader) ((char *) tuple - MINIMAL_TUPLE_OFFSET);
@@ -702,7 +702,7 @@ tuplesort_putheaptuple(Tuplesortstate *state, HeapTuple tup)
/* copy the tuple into sort storage */
tup = heap_copytuple(tup);
stup.tuple = (void *) tup;
stup.tuple = tup;
/*
* set up first-column key value, and potentially abbreviate, if it's a
@@ -1175,7 +1175,7 @@ readtup_heap(Tuplesortstate *state, SortTuple *stup,
LogicalTapeReadExact(tape, tupbody, tupbodylen);
if (base->sortopt & TUPLESORT_RANDOMACCESS) /* need trailing length word? */
LogicalTapeReadExact(tape, &tuplen, sizeof(tuplen));
stup->tuple = (void *) tuple;
stup->tuple = tuple;
/* set up first-column key value */
htup.t_len = tuple->t_len + MINIMAL_TUPLE_OFFSET;
htup.t_data = (HeapTupleHeader) ((char *) tuple - MINIMAL_TUPLE_OFFSET);
@@ -1372,7 +1372,7 @@ readtup_cluster(Tuplesortstate *state, SortTuple *stup,
LogicalTapeReadExact(tape, tuple->t_data, tuple->t_len);
if (base->sortopt & TUPLESORT_RANDOMACCESS) /* need trailing length word? */
LogicalTapeReadExact(tape, &tuplen, sizeof(tuplen));
stup->tuple = (void *) tuple;
stup->tuple = tuple;
/* set up first-column key value, if it's a simple column */
if (base->haveDatum1)
stup->datum1 = heap_getattr(tuple,
@@ -1681,7 +1681,7 @@ readtup_index(Tuplesortstate *state, SortTuple *stup,
LogicalTapeReadExact(tape, tuple, tuplen);
if (base->sortopt & TUPLESORT_RANDOMACCESS) /* need trailing length word? */
LogicalTapeReadExact(tape, &tuplen, sizeof(tuplen));
stup->tuple = (void *) tuple;
stup->tuple = tuple;
/* set up first-column key value */
stup->datum1 = index_getattr(tuple,
1,
@@ -1757,7 +1757,7 @@ readtup_index_brin(Tuplesortstate *state, SortTuple *stup,
LogicalTapeReadExact(tape, &tuple->tuple, tuplen);
if (base->sortopt & TUPLESORT_RANDOMACCESS) /* need trailing length word? */
LogicalTapeReadExact(tape, &tuplen, sizeof(tuplen));
stup->tuple = (void *) tuple;
stup->tuple = tuple;
/* set up first-column key value, which is block number */
stup->datum1 = tuple->tuple.bt_blkno;

View File

@@ -751,7 +751,7 @@ tuplestore_puttupleslot(Tuplestorestate *state,
tuple = ExecCopySlotMinimalTuple(slot);
USEMEM(state, GetMemoryChunkSpace(tuple));
tuplestore_puttuple_common(state, (void *) tuple);
tuplestore_puttuple_common(state, tuple);
MemoryContextSwitchTo(oldcxt);
}
@@ -771,7 +771,7 @@ tuplestore_puttuple(Tuplestorestate *state, HeapTuple tuple)
*/
tuple = COPYTUP(state, tuple);
tuplestore_puttuple_common(state, (void *) tuple);
tuplestore_puttuple_common(state, tuple);
MemoryContextSwitchTo(oldcxt);
}
@@ -790,7 +790,7 @@ tuplestore_putvalues(Tuplestorestate *state, TupleDesc tdesc,
tuple = heap_form_minimal_tuple(tdesc, values, isnull);
USEMEM(state, GetMemoryChunkSpace(tuple));
tuplestore_puttuple_common(state, (void *) tuple);
tuplestore_puttuple_common(state, tuple);
MemoryContextSwitchTo(oldcxt);
}
@@ -1592,7 +1592,7 @@ copytup_heap(Tuplestorestate *state, void *tup)
tuple = minimal_tuple_from_heap_tuple((HeapTuple) tup);
USEMEM(state, GetMemoryChunkSpace(tuple));
return (void *) tuple;
return tuple;
}
static void
@@ -1629,5 +1629,5 @@ readtup_heap(Tuplestorestate *state, unsigned int len)
BufFileReadExact(state->myfile, tupbody, tupbodylen);
if (state->backward) /* need trailing length word? */
BufFileReadExact(state->myfile, &tuplen, sizeof(tuplen));
return (void *) tuple;
return tuple;
}