8000 Remove useless casts to (void *) in hash_search() calls · postgrespro/postgres@54a177a · GitHub
[go: up one dir, main page]

Skip to content

Commit 54a177a

Browse files
committed
Remove useless casts to (void *) in hash_search() calls
Some of these appear to be leftovers from when hash_search() took a char * argument (changed in 5999e78). Since after this there is some more horizontal space available, do some light reformatting where suitable. Reviewed-by: Corey Huinker <corey.huinker@gmail.com> Discussion: https://www.postgresql.org/message-id/flat/fd9adf5d-b1aa-e82f-e4c7-263c30145807%40enterprisedb.com
1 parent 009f8d1 commit 54a177a

File tree

28 files changed

+108
-146
lines changed

28 files changed

+108
-146
lines changed

contrib/postgres_fdw/shippable.c

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ InvalidateShippableCacheCallback(Datum arg, int cacheid, uint32 hashvalue)
7777
while ((entry = (ShippableCacheEntry *) hash_seq_search(&status)) != NULL)
7878
{
7979
if (hash_search(ShippableCacheHash,
80-
(void *) &entry->key,
80+
&entry->key,
8181
HASH_REMOVE,
8282
NULL) == NULL)
8383
elog(ERROR, "hash table corrupted");
@@ -183,10 +183,7 @@ is_shippable(Oid objectId, Oid classId, PgFdwRelationInfo *fpinfo)
183183

184184
/* See if we already cached the result. */
185185
entry = (ShippableCacheEntry *)
186-
hash_search(ShippableCacheHash,
187-
(void *) &key,
188-
HASH_FIND,
189-
NULL);
186+
hash_search(ShippableCacheHash, &key, HASH_FIND, NULL);
190187

191188
if (!entry)
192189
{
@@ -199,10 +196,7 @@ is_shippable(Oid objectId, Oid classId, PgFdwRelationInfo *fpinfo)
199196
* cache invalidation.
200197
*/
201198
entry = (ShippableCacheEntry *)
202-
hash_search(ShippableCacheHash,
203-
(void *) &key,
204-
HASH_ENTER,
205-
NULL);
199+
hash_search(ShippableCacheHash, &key, HASH_ENTER, NULL);
206200

207201
entry->shippable = shippable;
208202
}

src/backend/access/gist/gistbuild.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1587,7 +1587,7 @@ gistMemorizeParent(GISTBuildState *buildstate, BlockNumber child, BlockNumber pa
15871587
bool found;
15881588

15891589
entry = (ParentMapEntry *) hash_search(buildstate->parentMap,
1590-
(const void *) &child,
1590+
&child,
15911591
HASH_ENTER,
15921592
&found);
15931593
entry->parentblkno = parent;
@@ -1625,7 +1625,7 @@ gistGetParent(GISTBuildState *buildstate, BlockNumber child)
16251625

16261626
/* Find node buffer in hash table */
16271627
entry = (ParentMapEntry *) hash_search(buildstate->parentMap,
1628-
(const void *) &child,
1628+
&child,
16291629
HASH_FIND,
16301630
&found);
16311631
if (!found)

src/backend/access/gist/gistbuildbuffers.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ gistGetNodeBuffer(GISTBuildBuffers *gfbb, GISTSTATE *giststate,
122122

123123
/* Find node buffer in hash table */
124124
nodeBuffer = (GISTNodeBuffer *) hash_search(gfbb->nodeBuffersTab,
125-
(const void *) &nodeBlocknum,
125+
&nodeBlocknum,
126126
HASH_ENTER,
127127
&found);
128128
if (!found)

src/backend/access/transam/xlogutils.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ log_invalid_page(RelFileLocator locator, ForkNumber forkno, BlockNumber blkno,
151151
key.forkno = forkno;
152152
key.blkno = blkno;
153153
hentry = (xl_invalid_page *)
154-
hash_search(invalid_page_tab, (void *) &key, HASH_ENTER, &found);
154+
hash_search(invalid_page_tab, &key, HASH_ENTER, &found);
155155

156156
if (!found)
157157
{
@@ -193,7 +193,7 @@ forget_invalid_pages(RelFileLocator locator, ForkNumber forkno,
193193
}
194194

195195
if (hash_search(invalid_page_tab,
196-
(void *) &hentry->key,
196+
&hentry->key,
197197
HASH_REMOVE, NULL) == NULL)
198198
elog(ERROR, "hash table corrupted");
199199
}
@@ -226,7 +226,7 @@ forget_invalid_pages_db(Oid dbid)
226226
}
227227

228228
if (hash_search(invalid_page_tab,
229-
(void *) &hentry->key,
229+
&hentry->key,
230230
HASH_REMOVE, NULL) == NULL)
231231
elog(ERROR, "hash table corrupted");
232232
}

src/backend/catalog/storage.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,7 @@ SerializePendingSyncs(Size maxSize, char *startAddress)
603603
/* remove deleted rnodes */
604604
for (delete = pendingDeletes; delete != NULL; delete = delete->next)
605605
if (delete->atCommit)
606-
(void) hash_search(tmphash, (void *) &delete->rlocator,
606+
(void) hash_search(tmphash, &delete->rlocator,
607607
HASH_REMOVE, NULL);
608608

609609
hash_seq_init(&scan, tmphash);
@@ -748,7 +748,7 @@ smgrDoPendingSyncs(bool isCommit, bool isParallelWorker)
748748
/* Skip syncing nodes that smgrDoPendingDeletes() will delete. */
749749
for (pending = pendingDeletes; pending != NULL; pending = pending->next)
750750
if (pending->atCommit)
751-
(void) hash_search(pendingSyncHash, (void *) &pending->rlocator,
751+
(void) hash_search(pendingSyncHash, &pending->rlocator,
752752
HASH_REMOVE, NULL);
753753

754754
hash_seq_init(&scan, pendingSyncHash);

src/backend/optimizer/util/predtest.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2040,7 +2040,7 @@ lookup_proof_cache(Oid pred_op, Oid clause_op, bool refute_it)
20402040
key.pred_op = pred_op;
20412041
key.clause_op = clause_op;
20422042
cache_entry = (OprProofCacheEntry *) hash_search(OprProofCacheHash,
2043-
(void *) &key,
2043+
&key,
20442044
HASH_ENTER, &cfound);
20452045
if (!cfound)
20462046
{

src/backend/parser/parse_oper.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1017,7 +1017,7 @@ find_oper_cache_entry(OprCacheKey *key)
10171017

10181018
/* Look for an existing entry */
10191019
oprentry = (OprCacheEntry *) hash_search(OprCacheHash,
1020-
(void *) key,
1020+
key,
10211021
HASH_FIND, NULL);
10221022
if (oprentry == NULL)
10231023
return InvalidOid;
@@ -1038,7 +1038,7 @@ make_oper_cache_entry(OprCacheKey *key, Oid opr_oid)
10381038
Assert(OprCacheHash != NULL);
10391039

10401040
oprentry = (OprCacheEntry *) hash_search(OprCacheHash,
1041-
(void *) key,
1041+
key,
10421042
HASH_ENTER, NULL);
10431043
oprentry->opr_oid = opr_oid;
10441044
}
@@ -1060,7 +1060,7 @@ InvalidateOprCacheCallBack(Datum arg, int cacheid, uint32 hashvalue)
10601060
while ((hentry = (OprCacheEntry *) hash_seq_search(&status)) != NULL)
10611061
{
10621062
if (hash_search(OprCacheHash,
1063-
(void *) &hentry->key,
1063+
&hentry->key,
10641064
HASH_REMOVE, NULL) == NULL)
10651065
elog(ERROR, "hash table corrupted");
10661066
}

src/backend/replication/logical/relation.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ logicalrep_relmap_update(LogicalRepRelation *remoterel)
167167
/*
168168
* HASH_ENTER returns the existing entry if present or creates a new one.
169169
*/
170-
entry = hash_search(LogicalRepRelMap, (void *) &remoterel->remoteid,
170+
entry = hash_search(LogicalRepRelMap, &remoterel->remoteid,
171171
HASH_ENTER, &found);
172172

173173
if (found)
@@ -326,7 +326,7 @@ logicalrep_rel_open(LogicalRepRelId remoteid, LOCKMODE lockmode)
326326
logicalrep_relmap_init();
327327

328328
/* Search for existing entry. */
329-
entry = hash_search(LogicalRepRelMap, (void *) &remoteid,
329+
entry = hash_search(LogicalRepRelMap, &remoteid,
330330
HASH_FIND, &found);
331331

332332
if (!found)
@@ -598,7 +598,7 @@ logicalrep_partition_open(LogicalRepRelMapEntry *root,
598598

599599
/* Search for existing entry. */
600600
part_entry = (LogicalRepPartMapEntry *) hash_search(LogicalRepPartMap,
601-
(void *) &partOid,
601+
&partOid,
602602
HASH_ENTER, &found);
603603

604604
entry = &part_entry->relmapentry;

src/backend/replication/logical/reorderbuffer.c

Lines changed: 8 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -657,7 +657,7 @@ ReorderBufferTXNByXid(ReorderBuffer *rb, TransactionId xid, bool create,
657657
/* search the lookup table */
658658
ent = (ReorderBufferTXNByIdEnt *)
659659
hash_search(rb->by_txn,
660-
(void *) &xid,
660+
&xid,
661661
create ? HASH_ENTER : HASH_FIND,
662662
&found);
663663
if (found)
@@ -1581,10 +1581,7 @@ ReorderBufferCleanupTXN(ReorderBuffer *rb, ReorderBufferTXN *txn)
15811581
dclist_delete_from(&rb->catchange_txns, &txn->catchange_node);
15821582

15831583
/* now remove reference from buffer */
1584-
hash_search(rb->by_txn,
1585-
(void *) &txn->xid,
1586-
HASH_REMOVE,
1587-
&found);
1584+
hash_search(rb->by_txn, &txn->xid, HASH_REMOVE, &found);
15881585
Assert(found);
15891586

15901587
/* remove entries spilled to disk */
@@ -1762,10 +1759,7 @@ ReorderBufferBuildTupleCidHash(ReorderBuffer *rb, ReorderBufferTXN *txn)
17621759
&key.tid);
17631760

17641761
ent = (ReorderBufferTupleCidEnt *)
1765-
hash_search(txn->tuplecid_hash,
1766-
(void *) &key,
1767-
HASH_ENTER,
1768-
&found);
1762+
hash_search(txn->tuplecid_hash, &key, HASH_ENTER, &found);
17691763
if (!found)
17701764
{
17711765
ent->cmin = change->data.tuplecid.cmin;
@@ -4653,10 +4647,7 @@ ReorderBufferToastAppendChunk(ReorderBuffer *rb, ReorderBufferTXN *txn,
46534647
Assert(!isnull);
46544648

46554649
ent = (ReorderBufferToastEnt *)
4656-
hash_search(txn->toast_hash,
4657-
(void *) &chunk_id,
4658-
HASH_ENTER,
4659-
&found);
4650+
hash_search(txn->toast_hash, &chunk_id, HASH_ENTER, &found);
46604651

46614652
if (!found)
46624653
{
@@ -4811,7 +4802,7 @@ ReorderBufferToastReplace(ReorderBuffer *rb, ReorderBufferTXN *txn,
48114802
*/
48124803
ent = (ReorderBufferToastEnt *)
48134804
hash_search(txn->toast_hash,
4814-
(void *) &toast_pointer.va_valueid,
4805+
&toast_pointer.va_valueid,
48154806
HASH_FIND,
48164807
NULL);
48174808
if (ent == NULL)
@@ -5053,10 +5044,7 @@ ApplyLogicalMappingFile(HTAB *tuplecid_data, Oid relid, const char *fname)
50535044

50545045

50555046
ent = (ReorderBufferTupleCidEnt *)
5056-
hash_search(tuplecid_data,
5057-
(void *) &key,
5058-
HASH_FIND,
5059-
NULL);
5047+
hash_search(tuplecid_data, &key, HASH_FIND, NULL);
50605048

50615049
/* no existing mapping, no need to update */
50625050
if (!ent)
@@ -5067,10 +5055,7 @@ ApplyLogicalMappingFile(HTAB *tuplecid_data, Oid relid, const char *fname)
50675055
&key.tid);
50685056

50695057
new_ent = (ReorderBufferTupleCidEnt *)
5070-
hash_search(tuplecid_data,
5071-
(void *) &key,
5072-
HASH_ENTER,
5073-
&found);
5058+
hash_search(tuplecid_data, &key, HASH_ENTER, &found);
50745059

50755060
if (found)
50765061
{
@@ -5249,10 +5234,7 @@ ResolveCminCmaxDuringDecoding(HTAB *tuplecid_data,
52495234

52505235
restart:
52515236
ent = (ReorderBufferTupleCidEnt *)
5252-
hash_search(tuplecid_data,
5253-
(void *) &key,
5254-
HASH_FIND,
5255-
NULL);
5237+
hash_search(tuplecid_data, &key, HASH_FIND, NULL);
52565238

52575239
/*
52585240
* failed to find a mapping, check whether the table was rewritten and

src/backend/replication/pgoutput/pgoutput.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2026,7 +2026,7 @@ get_rel_sync_entry(PGOutputData *data, Relation relation)
20262026

20272027
/* Find cached relation info, creating if not found */
20282028
entry = (RelationSyncEntry *) hash_search(RelationSyncCache,
2029-
(void *) &relid,
2029+
&relid,
20302030
HASH_ENTER, &found);
20312031
Assert(entry != NULL);
20322032

0 commit comments

Comments
 (0)
0