Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 54a177a

Browse filesBrowse 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
Copy full SHA for 54a177a

File tree

28 files changed

+108
-146
lines changed
Filter options

28 files changed

+108
-146
lines changed

‎contrib/postgres_fdw/shippable.c

Copy file name to clipboardExpand all lines: contrib/postgres_fdw/shippable.c
+3-9Lines 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

Copy file name to clipboardExpand all lines: src/backend/access/gist/gistbuild.c
+2-2Lines 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

Copy file name to clipboardExpand all lines: src/backend/access/gist/gistbuildbuffers.c
+1-1Lines 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

Copy file name to clipboardExpand all lines: src/backend/access/transam/xlogutils.c
+3-3Lines 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

Copy file name to clipboardExpand all lines: src/backend/catalog/storage.c
+2-2Lines 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

Copy file name to clipboardExpand all lines: src/backend/optimizer/util/predtest.c
+1-1Lines 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

Copy file name to clipboardExpand all lines: src/backend/parser/parse_oper.c
+3-3Lines 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

Copy file name to clipboardExpand all lines: src/backend/replication/logical/relation.c
+3-3Lines 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

Copy file name to clipboardExpand all lines: src/backend/replication/logical/reorderbuffer.c
+8-26Lines 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

Copy file name to clipboardExpand all lines: src/backend/replication/pgoutput/pgoutput.c
+1-1Lines 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

‎src/backend/storage/buffer/buf_table.c

Copy file name to clipboardExpand all lines: src/backend/storage/buffer/buf_table.c
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ BufTableLookup(BufferTag *tagPtr, uint32 hashcode)
9494

9595
result = (BufferLookupEnt *)
9696
hash_search_with_hash_value(SharedBufHash,
97-
(void *) tagPtr,
97+
tagPtr,
9898
hashcode,
9999
HASH_FIND,
100100
NULL);
@@ -126,7 +126,7 @@ BufTableInsert(BufferTag *tagPtr, uint32 hashcode, int buf_id)
126126

127127
result = (BufferLookupEnt *)
128128
hash_search_with_hash_value(SharedBufHash,
129-
(void *) tagPtr,
129+
tagPtr,
130130
hashcode,
131131
HASH_ENTER,
132132
&found);
@@ -152,7 +152,7 @@ BufTableDelete(BufferTag *tagPtr, uint32 hashcode)
152152

153153
result = (BufferLookupEnt *)
154154
hash_search_with_hash_value(SharedBufHash,
155-
(void *) tagPtr,
155+
tagPtr,
156156
hashcode,
157157
HASH_REMOVE,
158158
NULL);

‎src/backend/storage/buffer/bufmgr.c

Copy file name to clipboardExpand all lines: src/backend/storage/buffer/bufmgr.c
+4-13Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ ReservePrivateRefCountEntry(void)
262262

263263
/* enter victim array entry into hashtable */
264264
hashent = hash_search(PrivateRefCountHash,
265-
(void *) &(ReservedRefCountEntry->buffer),
265+
&(ReservedRefCountEntry->buffer),
266266
HASH_ENTER,
267267
&found);
268268
Assert(!found);
@@ -336,10 +336,7 @@ GetPrivateRefCountEntry(Buffer buffer, bool do_move)
336336
if (PrivateRefCountOverflowed == 0)
337337
return NULL;
338338

339-
res = hash_search(PrivateRefCountHash,
340-
(void *) &buffer,
341-
HASH_FIND,
342-
NULL);
339+
res = hash_search(PrivateRefCountHash, &buffer, HASH_FIND, NULL);
343340

344341
if (res == NULL)
345342
return NULL;
@@ -368,10 +365,7 @@ GetPrivateRefCountEntry(Buffer buffer, bool do_move)
368365
free->refcount = res->refcount;
369366

370367
/* delete from hashtable */
371-
hash_search(PrivateRefCountHash,
372-
(void *) &buffer,
373-
HASH_REMOVE,
374-
&found);
368+
hash_search(PrivateRefCountHash, &buffer, HASH_REMOVE, &found);
375369
Assert(found);
376370
Assert(PrivateRefCountOverflowed > 0);
377371
PrivateRefCountOverflowed--;
@@ -430,10 +424,7 @@ ForgetPrivateRefCountEntry(PrivateRefCountEntry *ref)
430424
bool found;
431425
Buffer buffer = ref->buffer;
432426

433-
hash_search(PrivateRefCountHash,
434-
(void *) &buffer,
435-
HASH_REMOVE,
436-
&found);
427+
hash_search(PrivateRefCountHash, &buffer, HASH_REMOVE, &found);
437428
Assert(found);
438429
Assert(PrivateRefCountOverflowed > 0);
439430
PrivateRefCountOverflowed--;

‎src/backend/storage/buffer/localbuf.c

Copy file name to clipboardExpand all lines: src/backend/storage/buffer/localbuf.c
+6-9Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ PrefetchLocalBuffer(SMgrRelation smgr, ForkNumber forkNum,
7676

7777
/* See if the desired buffer already exists */
7878
hresult = (LocalBufferLookupEnt *)
79-
hash_search(LocalBufHash, (void *) &newTag, HASH_FIND, NULL);
79+
hash_search(LocalBufHash, &newTag, HASH_FIND, NULL);
8080

8181
if (hresult)
8282
{
@@ -125,7 +125,7 @@ LocalBufferAlloc(SMgrRelation smgr, ForkNumber forkNum, BlockNumber blockNum,
125125

126126
/* See if the desired buffer already exists */
127127
hresult = (LocalBufferLookupEnt *)
128-
hash_search(LocalBufHash, (void *) &newTag, HASH_FIND, NULL);
128+
hash_search(LocalBufHash, &newTag, HASH_FIND, NULL);
129129

130130
if (hresult)
131131
{
@@ -248,8 +248,7 @@ LocalBufferAlloc(SMgrRelation smgr, ForkNumber forkNum, BlockNumber blockNum,
248248
if (buf_state & BM_TAG_VALID)
249249
{
250250
hresult = (LocalBufferLookupEnt *)
251-
hash_search(LocalBufHash, (void *) &bufHdr->tag,
252-
HASH_REMOVE, NULL);
251+
hash_search(LocalBufHash, &bufHdr->tag, HASH_REMOVE, NULL);
253252
if (!hresult) /* shouldn't happen */
254253
elog(ERROR, "local buffer hash table corrupted");
255254
/* mark buffer invalid just in case hash insert fails */
@@ -259,7 +258,7 @@ LocalBufferAlloc(SMgrRelation smgr, ForkNumber forkNum, BlockNumber blockNum,
259258
}
260259

261260
hresult = (LocalBufferLookupEnt *)
262-
hash_search(LocalBufHash, (void *) &newTag, HASH_ENTER, &found);
261+
hash_search(LocalBufHash, &newTag, HASH_ENTER, &found);
263262
if (found) /* shouldn't happen */
264263
elog(ERROR, "local buffer hash table corrupted");
265264
hresult->id = b;
@@ -351,8 +350,7 @@ DropRelationLocalBuffers(RelFileLocator rlocator, ForkNumber forkNum,
351350

352351
/* Remove entry from hashtable */
353352
hresult = (LocalBufferLookupEnt *)
354-
hash_search(LocalBufHash, (void *) &bufHdr->tag,
355-
HASH_REMOVE, NULL);
353+
hash_search(LocalBufHash, &bufHdr->tag, HASH_REMOVE, NULL);
356354
if (!hresult) /* shouldn't happen */
357355
elog(ERROR, "local buffer hash table corrupted");
358356
/* Mark buffer invalid */
@@ -396,8 +394,7 @@ DropRelationAllLocalBuffers(RelFileLocator rlocator)
396394
LocalRefCount[i]);
397395
/* Remove entry from hashtable */
398396
hresult = (LocalBufferLookupEnt *)
399-
hash_search(LocalBufHash, (void *) &bufHdr->tag,
400-
HASH_REMOVE, NULL);
397+
hash_search(LocalBufHash, &bufHdr->tag, HASH_REMOVE, NULL);
401398
if (!hresult) /* shouldn't happen */
402399
elog(ERROR, "local buffer hash table corrupted");
403400
/* Mark buffer invalid */

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.