mirror of
https://github.com/postgres/postgres.git
synced 2025-11-22 12:22:45 +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:
@@ -1222,7 +1222,7 @@ brinbuild(Relation heap, Relation index, IndexInfo *indexInfo)
|
||||
* generate summary for the same range twice).
|
||||
*/
|
||||
reltuples = table_index_build_scan(heap, index, indexInfo, false, true,
|
||||
brinbuildCallback, (void *) state, NULL);
|
||||
brinbuildCallback, state, NULL);
|
||||
|
||||
/*
|
||||
* process the final batch
|
||||
@@ -1808,7 +1808,7 @@ summarize_range(IndexInfo *indexInfo, BrinBuildState *state, Relation heapRel,
|
||||
state->bs_currRangeStart = heapBlk;
|
||||
table_index_build_range_scan(heapRel, state->bs_irel, indexInfo, false, true, false,
|
||||
heapBlk, scanNumBlks,
|
||||
brinbuildCallback, (void *) state, NULL);
|
||||
brinbuildCallback, state, NULL);
|
||||
|
||||
/*
|
||||
* Now we update the values obtained by the scan with the placeholder
|
||||
|
||||
@@ -413,7 +413,7 @@ AssertCheckRanges(Ranges *ranges, FmgrInfo *cmpFn, Oid colloid)
|
||||
|
||||
Assert(bsearch_arg(&value, &ranges->values[2 * ranges->nranges],
|
||||
ranges->nsorted, sizeof(Datum),
|
||||
compare_values, (void *) &cxt) == NULL);
|
||||
compare_values, &cxt) == NULL);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -550,7 +550,7 @@ range_deduplicate_values(Ranges *range)
|
||||
/* same as preceding value, so store it */
|
||||
if (compare_values(&range->values[start + i - 1],
|
||||
&range->values[start + i],
|
||||
(void *) &cxt) == 0)
|
||||
&cxt) == 0)
|
||||
continue;
|
||||
|
||||
range->values[start + n] = range->values[start + i];
|
||||
@@ -1085,7 +1085,7 @@ range_contains_value(BrinDesc *bdesc, Oid colloid,
|
||||
|
||||
if (bsearch_arg(&newval, &ranges->values[2 * ranges->nranges],
|
||||
ranges->nsorted, sizeof(Datum),
|
||||
compare_values, (void *) &cxt) != NULL)
|
||||
compare_values, &cxt) != NULL)
|
||||
return true;
|
||||
}
|
||||
else
|
||||
@@ -1206,7 +1206,7 @@ sort_expanded_ranges(FmgrInfo *cmp, Oid colloid,
|
||||
for (i = 1; i < neranges; i++)
|
||||
{
|
||||
/* if the current range is equal to the preceding one, do nothing */
|
||||
if (!compare_expanded_ranges(&eranges[i - 1], &eranges[i], (void *) &cxt))
|
||||
if (!compare_expanded_ranges(&eranges[i - 1], &eranges[i], &cxt))
|
||||
continue;
|
||||
|
||||
/* otherwise, copy it to n-th place (if not already there) */
|
||||
|
||||
@@ -88,7 +88,7 @@ detoast_external_attr(struct varlena *attr)
|
||||
eoh = DatumGetEOHP(PointerGetDatum(attr));
|
||||
resultsize = EOH_get_flat_size(eoh);
|
||||
result = (struct varlena *) palloc(resultsize);
|
||||
EOH_flatten_into(eoh, (void *) result, resultsize);
|
||||
EOH_flatten_into(eoh, result, resultsize);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -117,7 +117,7 @@ ginInitBA(BuildAccumulator *accum)
|
||||
ginCombineData,
|
||||
ginAllocEntryAccumulator,
|
||||
NULL, /* no freefunc needed */
|
||||
(void *) accum);
|
||||
accum);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -380,8 +380,7 @@ ginbuild(Relation heap, Relation index, IndexInfo *indexInfo)
|
||||
* prefers to receive tuples in TID order.
|
||||
*/
|
||||
reltuples = table_index_build_scan(heap, index, indexInfo, false, true,
|
||||
ginBuildCallback, (void *) &buildstate,
|
||||
NULL);
|
||||
ginBuildCallback, &buildstate, NULL);
|
||||
|
||||
/* dump remaining entries to the index */
|
||||
oldCtx = MemoryContextSwitchTo(buildstate.tmpCtx);
|
||||
@@ -497,7 +496,7 @@ gininsert(Relation index, Datum *values, bool *isnull,
|
||||
oldCtx = MemoryContextSwitchTo(indexInfo->ii_Context);
|
||||
ginstate = (GinState *) palloc(sizeof(GinState));
|
||||
initGinState(ginstate, index);
|
||||
indexInfo->ii_AmCache = (void *) ginstate;
|
||||
indexInfo->ii_AmCache = ginstate;
|
||||
MemoryContextSwitchTo(oldCtx);
|
||||
}
|
||||
|
||||
|
||||
@@ -173,7 +173,7 @@ gistinsert(Relation r, Datum *values, bool *isnull,
|
||||
oldCxt = MemoryContextSwitchTo(indexInfo->ii_Context);
|
||||
giststate = initGISTstate(r);
|
||||
giststate->tempCxt = createTempGistContext();
|
||||
indexInfo->ii_AmCache = (void *) giststate;
|
||||
indexInfo->ii_AmCache = giststate;
|
||||
MemoryContextSwitchTo(oldCxt);
|
||||
}
|
||||
|
||||
|
||||
@@ -273,7 +273,7 @@ gistbuild(Relation heap, Relation index, IndexInfo *indexInfo)
|
||||
/* Scan the table, adding all tuples to the tuplesort */
|
||||
reltuples = table_index_build_scan(heap, index, indexInfo, true, true,
|
||||
gistSortedBuildCallback,
|
||||
(void *) &buildstate, NULL);
|
||||
&buildstate, NULL);
|
||||
|
||||
/*
|
||||
* Perform the sort and build index pages.
|
||||
@@ -312,7 +312,7 @@ gistbuild(Relation heap, Relation index, IndexInfo *indexInfo)
|
||||
/* Scan the table, inserting all the tuples to the index. */
|
||||
reltuples = table_index_build_scan(heap, index, indexInfo, true, true,
|
||||
gistBuildCallback,
|
||||
(void *) &buildstate, NULL);
|
||||
&buildstate, NULL);
|
||||
|
||||
/*
|
||||
* If buffering was used, flush out all the tuples that are still in
|
||||
|
||||
@@ -173,7 +173,7 @@ hashbuild(Relation heap, Relation index, IndexInfo *indexInfo)
|
||||
/* do the heap scan */
|
||||
reltuples = table_index_build_scan(heap, index, indexInfo, true, true,
|
||||
hashbuildCallback,
|
||||
(void *) &buildstate, NULL);
|
||||
&buildstate, NULL);
|
||||
pgstat_progress_update_param(PROGRESS_CREATEIDX_TUPLES_TOTAL,
|
||||
buildstate.indtuples);
|
||||
|
||||
|
||||
@@ -2453,7 +2453,7 @@ lazy_vacuum_one_index(Relation indrel, IndexBulkDeleteResult *istat,
|
||||
InvalidBlockNumber, InvalidOffsetNumber);
|
||||
|
||||
/* Do bulk deletion */
|
||||
istat = vac_bulkdel_one_index(&ivinfo, istat, (void *) vacrel->dead_items,
|
||||
istat = vac_bulkdel_one_index(&ivinfo, istat, vacrel->dead_items,
|
||||
vacrel->dead_items_info);
|
||||
|
||||
/* Revert to the previous phase information for error traceback */
|
||||
|
||||
@@ -566,7 +566,7 @@ btparallelrescan(IndexScanDesc scan)
|
||||
|
||||
Assert(parallel_scan);
|
||||
|
||||
btscan = (BTParallelScanDesc) OffsetToPointer((void *) parallel_scan,
|
||||
btscan = (BTParallelScanDesc) OffsetToPointer(parallel_scan,
|
||||
parallel_scan->ps_offset);
|
||||
|
||||
/*
|
||||
@@ -644,7 +644,7 @@ _bt_parallel_seize(IndexScanDesc scan, BlockNumber *next_scan_page,
|
||||
return false;
|
||||
}
|
||||
|
||||
btscan = (BTParallelScanDesc) OffsetToPointer((void *) parallel_scan,
|
||||
btscan = (BTParallelScanDesc) OffsetToPointer(parallel_scan,
|
||||
parallel_scan->ps_offset);
|
||||
|
||||
while (1)
|
||||
@@ -752,7 +752,7 @@ _bt_parallel_release(IndexScanDesc scan, BlockNumber next_scan_page,
|
||||
|
||||
Assert(BlockNumberIsValid(next_scan_page));
|
||||
|
||||
btscan = (BTParallelScanDesc) OffsetToPointer((void *) parallel_scan,
|
||||
btscan = (BTParallelScanDesc) OffsetToPointer(parallel_scan,
|
||||
parallel_scan->ps_offset);
|
||||
|
||||
SpinLockAcquire(&btscan->btps_mutex);
|
||||
@@ -791,7 +791,7 @@ _bt_parallel_done(IndexScanDesc scan)
|
||||
if (so->needPrimScan)
|
||||
return;
|
||||
|
||||
btscan = (BTParallelScanDesc) OffsetToPointer((void *) parallel_scan,
|
||||
btscan = (BTParallelScanDesc) OffsetToPointer(parallel_scan,
|
||||
parallel_scan->ps_offset);
|
||||
|
||||
/*
|
||||
@@ -829,7 +829,7 @@ _bt_parallel_primscan_schedule(IndexScanDesc scan, BlockNumber curr_page)
|
||||
|
||||
Assert(so->numArrayKeys);
|
||||
|
||||
btscan = (BTParallelScanDesc) OffsetToPointer((void *) parallel_scan,
|
||||
btscan = (BTParallelScanDesc) OffsetToPointer(parallel_scan,
|
||||
parallel_scan->ps_offset);
|
||||
|
||||
SpinLockAcquire(&btscan->btps_mutex);
|
||||
|
||||
@@ -475,7 +475,7 @@ _bt_spools_heapscan(Relation heap, Relation index, BTBuildState *buildstate,
|
||||
/* Fill spool using either serial or parallel heap scan */
|
||||
if (!buildstate->btleader)
|
||||
reltuples = table_index_build_scan(heap, index, indexInfo, true, true,
|
||||
_bt_build_callback, (void *) buildstate,
|
||||
_bt_build_callback, buildstate,
|
||||
NULL);
|
||||
else
|
||||
reltuples = _bt_parallel_heapscan(buildstate,
|
||||
@@ -1930,7 +1930,7 @@ _bt_parallel_scan_and_sort(BTSpool *btspool, BTSpool *btspool2,
|
||||
ParallelTableScanFromBTShared(btshared));
|
||||
reltuples = table_index_build_scan(btspool->heap, btspool->index, indexInfo,
|
||||
true, progress, _bt_build_callback,
|
||||
(void *) &buildstate, scan);
|
||||
&buildstate, scan);
|
||||
|
||||
/* Execute this worker's part of the sort */
|
||||
if (progress)
|
||||
|
||||
@@ -122,7 +122,7 @@ spgbuild(Relation heap, Relation index, IndexInfo *indexInfo)
|
||||
ALLOCSET_DEFAULT_SIZES);
|
||||
|
||||
reltuples = table_index_build_scan(heap, index, indexInfo, true, true,
|
||||
spgistBuildCallback, (void *) &buildstate,
|
||||
spgistBuildCallback, &buildstate,
|
||||
NULL);
|
||||
|
||||
MemoryContextDelete(buildstate.tmpCtx);
|
||||
|
||||
@@ -279,7 +279,7 @@ spgGetCache(Relation index)
|
||||
UnlockReleaseBuffer(metabuffer);
|
||||
}
|
||||
|
||||
index->rd_amcache = (void *) cache;
|
||||
index->rd_amcache = cache;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -747,7 +747,7 @@ pg_prepared_xact(PG_FUNCTION_ARGS)
|
||||
* out as a result set.
|
||||
*/
|
||||
status = (Working_State *) palloc(sizeof(Working_State));
|
||||
funcctx->user_fctx = (void *) status;
|
||||
funcctx->user_fctx = status;
|
||||
|
||||
status->ngxacts = GetPreparedTransactionList(&status->array);
|
||||
status->currIdx = 0;
|
||||
@@ -1707,8 +1707,7 @@ ProcessRecords(char *bufptr, TransactionId xid,
|
||||
bufptr += MAXALIGN(sizeof(TwoPhaseRecordOnDisk));
|
||||
|
||||
if (callbacks[record->rmid] != NULL)
|
||||
callbacks[record->rmid] (xid, record->info,
|
||||
(void *) bufptr, record->len);
|
||||
callbacks[record->rmid] (xid, record->info, bufptr, record->len);
|
||||
|
||||
bufptr += MAXALIGN(record->len);
|
||||
}
|
||||
|
||||
@@ -1913,7 +1913,7 @@ ApplyWalRecord(XLogReaderState *xlogreader, XLogRecord *record, TimeLineID *repl
|
||||
|
||||
/* Setup error traceback support for ereport() */
|
||||
errcallback.callback = rm_redo_error_callback;
|
||||
errcallback.arg = (void *) xlogreader;
|
||||
errcallback.arg = xlogreader;
|
||||
errcallback.previous = error_context_stack;
|
||||
error_context_stack = &errcallback;
|
||||
|
||||
@@ -4821,7 +4821,7 @@ check_recovery_target_lsn(char **newval, void **extra, GucSource source)
|
||||
|
||||
myextra = (XLogRecPtr *) guc_malloc(ERROR, sizeof(XLogRecPtr));
|
||||
*myextra = lsn;
|
||||
*extra = (void *) myextra;
|
||||
*extra = myextra;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -4985,7 +4985,7 @@ check_recovery_target_timeline(char **newval, void **extra, GucSource source)
|
||||
|
||||
myextra = (RecoveryTargetTimeLineGoal *) guc_malloc(ERROR, sizeof(RecoveryTargetTimeLineGoal));
|
||||
*myextra = rttg;
|
||||
*extra = (void *) myextra;
|
||||
*extra = myextra;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -5021,7 +5021,7 @@ check_recovery_target_xid(char **newval, void **extra, GucSource source)
|
||||
|
||||
myextra = (TransactionId *) guc_malloc(ERROR, sizeof(TransactionId));
|
||||
*myextra = xid;
|
||||
*extra = (void *) myextra;
|
||||
*extra = myextra;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user