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 5999e78fc4).

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
This commit is contained in:
Peter Eisentraut 2023-02-06 09:05:20 +01:00
parent 009f8d1714
commit 54a177a948
28 changed files with 108 additions and 146 deletions

View File

@ -77,7 +77,7 @@ InvalidateShippableCacheCallback(Datum arg, int cacheid, uint32 hashvalue)
while ((entry = (ShippableCacheEntry *) hash_seq_search(&status)) != NULL)
{
if (hash_search(ShippableCacheHash,
(void *) &entry->key,
&entry->key,
HASH_REMOVE,
NULL) == NULL)
elog(ERROR, "hash table corrupted");
@ -183,10 +183,7 @@ is_shippable(Oid objectId, Oid classId, PgFdwRelationInfo *fpinfo)
/* See if we already cached the result. */
entry = (ShippableCacheEntry *)
hash_search(ShippableCacheHash,
(void *) &key,
HASH_FIND,
NULL);
hash_search(ShippableCacheHash, &key, HASH_FIND, NULL);
if (!entry)
{
@ -199,10 +196,7 @@ is_shippable(Oid objectId, Oid classId, PgFdwRelationInfo *fpinfo)
* cache invalidation.
*/
entry = (ShippableCacheEntry *)
hash_search(ShippableCacheHash,
(void *) &key,
HASH_ENTER,
NULL);
hash_search(ShippableCacheHash, &key, HASH_ENTER, NULL);
entry->shippable = shippable;
}

View File

@ -1587,7 +1587,7 @@ gistMemorizeParent(GISTBuildState *buildstate, BlockNumber child, BlockNumber pa
bool found;
entry = (ParentMapEntry *) hash_search(buildstate->parentMap,
(const void *) &child,
&child,
HASH_ENTER,
&found);
entry->parentblkno = parent;
@ -1625,7 +1625,7 @@ gistGetParent(GISTBuildState *buildstate, BlockNumber child)
/* Find node buffer in hash table */
entry = (ParentMapEntry *) hash_search(buildstate->parentMap,
(const void *) &child,
&child,
HASH_FIND,
&found);
if (!found)

View File

@ -122,7 +122,7 @@ gistGetNodeBuffer(GISTBuildBuffers *gfbb, GISTSTATE *giststate,
/* Find node buffer in hash table */
nodeBuffer = (GISTNodeBuffer *) hash_search(gfbb->nodeBuffersTab,
(const void *) &nodeBlocknum,
&nodeBlocknum,
HASH_ENTER,
&found);
if (!found)

View File

@ -151,7 +151,7 @@ log_invalid_page(RelFileLocator locator, ForkNumber forkno, BlockNumber blkno,
key.forkno = forkno;
key.blkno = blkno;
hentry = (xl_invalid_page *)
hash_search(invalid_page_tab, (void *) &key, HASH_ENTER, &found);
hash_search(invalid_page_tab, &key, HASH_ENTER, &found);
if (!found)
{
@ -193,7 +193,7 @@ forget_invalid_pages(RelFileLocator locator, ForkNumber forkno,
}
if (hash_search(invalid_page_tab,
(void *) &hentry->key,
&hentry->key,
HASH_REMOVE, NULL) == NULL)
elog(ERROR, "hash table corrupted");
}
@ -226,7 +226,7 @@ forget_invalid_pages_db(Oid dbid)
}
if (hash_search(invalid_page_tab,
(void *) &hentry->key,
&hentry->key,
HASH_REMOVE, NULL) == NULL)
elog(ERROR, "hash table corrupted");
}

View File

@ -603,7 +603,7 @@ SerializePendingSyncs(Size maxSize, char *startAddress)
/* remove deleted rnodes */
for (delete = pendingDeletes; delete != NULL; delete = delete->next)
if (delete->atCommit)
(void) hash_search(tmphash, (void *) &delete->rlocator,
(void) hash_search(tmphash, &delete->rlocator,
HASH_REMOVE, NULL);
hash_seq_init(&scan, tmphash);
@ -748,7 +748,7 @@ smgrDoPendingSyncs(bool isCommit, bool isParallelWorker)
/* Skip syncing nodes that smgrDoPendingDeletes() will delete. */
for (pending = pendingDeletes; pending != NULL; pending = pending->next)
if (pending->atCommit)
(void) hash_search(pendingSyncHash, (void *) &pending->rlocator,
(void) hash_search(pendingSyncHash, &pending->rlocator,
HASH_REMOVE, NULL);
hash_seq_init(&scan, pendingSyncHash);

View File

@ -2040,7 +2040,7 @@ lookup_proof_cache(Oid pred_op, Oid clause_op, bool refute_it)
key.pred_op = pred_op;
key.clause_op = clause_op;
cache_entry = (OprProofCacheEntry *) hash_search(OprProofCacheHash,
(void *) &key,
&key,
HASH_ENTER, &cfound);
if (!cfound)
{

View File

@ -1017,7 +1017,7 @@ find_oper_cache_entry(OprCacheKey *key)
/* Look for an existing entry */
oprentry = (OprCacheEntry *) hash_search(OprCacheHash,
(void *) key,
key,
HASH_FIND, NULL);
if (oprentry == NULL)
return InvalidOid;
@ -1038,7 +1038,7 @@ make_oper_cache_entry(OprCacheKey *key, Oid opr_oid)
Assert(OprCacheHash != NULL);
oprentry = (OprCacheEntry *) hash_search(OprCacheHash,
(void *) key,
key,
HASH_ENTER, NULL);
oprentry->opr_oid = opr_oid;
}
@ -1060,7 +1060,7 @@ InvalidateOprCacheCallBack(Datum arg, int cacheid, uint32 hashvalue)
while ((hentry = (OprCacheEntry *) hash_seq_search(&status)) != NULL)
{
if (hash_search(OprCacheHash,
(void *) &hentry->key,
&hentry->key,
HASH_REMOVE, NULL) == NULL)
elog(ERROR, "hash table corrupted");
}

View File

@ -167,7 +167,7 @@ logicalrep_relmap_update(LogicalRepRelation *remoterel)
/*
* HASH_ENTER returns the existing entry if present or creates a new one.
*/
entry = hash_search(LogicalRepRelMap, (void *) &remoterel->remoteid,
entry = hash_search(LogicalRepRelMap, &remoterel->remoteid,
HASH_ENTER, &found);
if (found)
@ -326,7 +326,7 @@ logicalrep_rel_open(LogicalRepRelId remoteid, LOCKMODE lockmode)
logicalrep_relmap_init();
/* Search for existing entry. */
entry = hash_search(LogicalRepRelMap, (void *) &remoteid,
entry = hash_search(LogicalRepRelMap, &remoteid,
HASH_FIND, &found);
if (!found)
@ -598,7 +598,7 @@ logicalrep_partition_open(LogicalRepRelMapEntry *root,
/* Search for existing entry. */
part_entry = (LogicalRepPartMapEntry *) hash_search(LogicalRepPartMap,
(void *) &partOid,
&partOid,
HASH_ENTER, &found);
entry = &part_entry->relmapentry;

View File

@ -657,7 +657,7 @@ ReorderBufferTXNByXid(ReorderBuffer *rb, TransactionId xid, bool create,
/* search the lookup table */
ent = (ReorderBufferTXNByIdEnt *)
hash_search(rb->by_txn,
(void *) &xid,
&xid,
create ? HASH_ENTER : HASH_FIND,
&found);
if (found)
@ -1581,10 +1581,7 @@ ReorderBufferCleanupTXN(ReorderBuffer *rb, ReorderBufferTXN *txn)
dclist_delete_from(&rb->catchange_txns, &txn->catchange_node);
/* now remove reference from buffer */
hash_search(rb->by_txn,
(void *) &txn->xid,
HASH_REMOVE,
&found);
hash_search(rb->by_txn, &txn->xid, HASH_REMOVE, &found);
Assert(found);
/* remove entries spilled to disk */
@ -1762,10 +1759,7 @@ ReorderBufferBuildTupleCidHash(ReorderBuffer *rb, ReorderBufferTXN *txn)
&key.tid);
ent = (ReorderBufferTupleCidEnt *)
hash_search(txn->tuplecid_hash,
(void *) &key,
HASH_ENTER,
&found);
hash_search(txn->tuplecid_hash, &key, HASH_ENTER, &found);
if (!found)
{
ent->cmin = change->data.tuplecid.cmin;
@ -4653,10 +4647,7 @@ ReorderBufferToastAppendChunk(ReorderBuffer *rb, ReorderBufferTXN *txn,
Assert(!isnull);
ent = (ReorderBufferToastEnt *)
hash_search(txn->toast_hash,
(void *) &chunk_id,
HASH_ENTER,
&found);
hash_search(txn->toast_hash, &chunk_id, HASH_ENTER, &found);
if (!found)
{
@ -4811,7 +4802,7 @@ ReorderBufferToastReplace(ReorderBuffer *rb, ReorderBufferTXN *txn,
*/
ent = (ReorderBufferToastEnt *)
hash_search(txn->toast_hash,
(void *) &toast_pointer.va_valueid,
&toast_pointer.va_valueid,
HASH_FIND,
NULL);
if (ent == NULL)
@ -5053,10 +5044,7 @@ ApplyLogicalMappingFile(HTAB *tuplecid_data, Oid relid, const char *fname)
ent = (ReorderBufferTupleCidEnt *)
hash_search(tuplecid_data,
(void *) &key,
HASH_FIND,
NULL);
hash_search(tuplecid_data, &key, HASH_FIND, NULL);
/* no existing mapping, no need to update */
if (!ent)
@ -5067,10 +5055,7 @@ ApplyLogicalMappingFile(HTAB *tuplecid_data, Oid relid, const char *fname)
&key.tid);
new_ent = (ReorderBufferTupleCidEnt *)
hash_search(tuplecid_data,
(void *) &key,
HASH_ENTER,
&found);
hash_search(tuplecid_data, &key, HASH_ENTER, &found);
if (found)
{
@ -5249,10 +5234,7 @@ ResolveCminCmaxDuringDecoding(HTAB *tuplecid_data,
restart:
ent = (ReorderBufferTupleCidEnt *)
hash_search(tuplecid_data,
(void *) &key,
HASH_FIND,
NULL);
hash_search(tuplecid_data, &key, HASH_FIND, NULL);
/*
* failed to find a mapping, check whether the table was rewritten and

View File

@ -2026,7 +2026,7 @@ get_rel_sync_entry(PGOutputData *data, Relation relation)
/* Find cached relation info, creating if not found */
entry = (RelationSyncEntry *) hash_search(RelationSyncCache,
(void *) &relid,
&relid,
HASH_ENTER, &found);
Assert(entry != NULL);

View File

@ -94,7 +94,7 @@ BufTableLookup(BufferTag *tagPtr, uint32 hashcode)
result = (BufferLookupEnt *)
hash_search_with_hash_value(SharedBufHash,
(void *) tagPtr,
tagPtr,
hashcode,
HASH_FIND,
NULL);
@ -126,7 +126,7 @@ BufTableInsert(BufferTag *tagPtr, uint32 hashcode, int buf_id)
result = (BufferLookupEnt *)
hash_search_with_hash_value(SharedBufHash,
(void *) tagPtr,
tagPtr,
hashcode,
HASH_ENTER,
&found);
@ -152,7 +152,7 @@ BufTableDelete(BufferTag *tagPtr, uint32 hashcode)
result = (BufferLookupEnt *)
hash_search_with_hash_value(SharedBufHash,
(void *) tagPtr,
tagPtr,
hashcode,
HASH_REMOVE,
NULL);

View File

@ -262,7 +262,7 @@ ReservePrivateRefCountEntry(void)
/* enter victim array entry into hashtable */
hashent = hash_search(PrivateRefCountHash,
(void *) &(ReservedRefCountEntry->buffer),
&(ReservedRefCountEntry->buffer),
HASH_ENTER,
&found);
Assert(!found);
@ -336,10 +336,7 @@ GetPrivateRefCountEntry(Buffer buffer, bool do_move)
if (PrivateRefCountOverflowed == 0)
return NULL;
res = hash_search(PrivateRefCountHash,
(void *) &buffer,
HASH_FIND,
NULL);
res = hash_search(PrivateRefCountHash, &buffer, HASH_FIND, NULL);
if (res == NULL)
return NULL;
@ -368,10 +365,7 @@ GetPrivateRefCountEntry(Buffer buffer, bool do_move)
free->refcount = res->refcount;
/* delete from hashtable */
hash_search(PrivateRefCountHash,
(void *) &buffer,
HASH_REMOVE,
&found);
hash_search(PrivateRefCountHash, &buffer, HASH_REMOVE, &found);
Assert(found);
Assert(PrivateRefCountOverflowed > 0);
PrivateRefCountOverflowed--;
@ -430,10 +424,7 @@ ForgetPrivateRefCountEntry(PrivateRefCountEntry *ref)
bool found;
Buffer buffer = ref->buffer;
hash_search(PrivateRefCountHash,
(void *) &buffer,
HASH_REMOVE,
&found);
hash_search(PrivateRefCountHash, &buffer, HASH_REMOVE, &found);
Assert(found);
Assert(PrivateRefCountOverflowed > 0);
PrivateRefCountOverflowed--;

View File

@ -76,7 +76,7 @@ PrefetchLocalBuffer(SMgrRelation smgr, ForkNumber forkNum,
/* See if the desired buffer already exists */
hresult = (LocalBufferLookupEnt *)
hash_search(LocalBufHash, (void *) &newTag, HASH_FIND, NULL);
hash_search(LocalBufHash, &newTag, HASH_FIND, NULL);
if (hresult)
{
@ -125,7 +125,7 @@ LocalBufferAlloc(SMgrRelation smgr, ForkNumber forkNum, BlockNumber blockNum,
/* See if the desired buffer already exists */
hresult = (LocalBufferLookupEnt *)
hash_search(LocalBufHash, (void *) &newTag, HASH_FIND, NULL);
hash_search(LocalBufHash, &newTag, HASH_FIND, NULL);
if (hresult)
{
@ -248,8 +248,7 @@ LocalBufferAlloc(SMgrRelation smgr, ForkNumber forkNum, BlockNumber blockNum,
if (buf_state & BM_TAG_VALID)
{
hresult = (LocalBufferLookupEnt *)
hash_search(LocalBufHash, (void *) &bufHdr->tag,
HASH_REMOVE, NULL);
hash_search(LocalBufHash, &bufHdr->tag, HASH_REMOVE, NULL);
if (!hresult) /* shouldn't happen */
elog(ERROR, "local buffer hash table corrupted");
/* mark buffer invalid just in case hash insert fails */
@ -259,7 +258,7 @@ LocalBufferAlloc(SMgrRelation smgr, ForkNumber forkNum, BlockNumber blockNum,
}
hresult = (LocalBufferLookupEnt *)
hash_search(LocalBufHash, (void *) &newTag, HASH_ENTER, &found);
hash_search(LocalBufHash, &newTag, HASH_ENTER, &found);
if (found) /* shouldn't happen */
elog(ERROR, "local buffer hash table corrupted");
hresult->id = b;
@ -351,8 +350,7 @@ DropRelationLocalBuffers(RelFileLocator rlocator, ForkNumber forkNum,
/* Remove entry from hashtable */
hresult = (LocalBufferLookupEnt *)
hash_search(LocalBufHash, (void *) &bufHdr->tag,
HASH_REMOVE, NULL);
hash_search(LocalBufHash, &bufHdr->tag, HASH_REMOVE, NULL);
if (!hresult) /* shouldn't happen */
elog(ERROR, "local buffer hash table corrupted");
/* Mark buffer invalid */
@ -396,8 +394,7 @@ DropRelationAllLocalBuffers(RelFileLocator rlocator)
LocalRefCount[i]);
/* Remove entry from hashtable */
hresult = (LocalBufferLookupEnt *)
hash_search(LocalBufHash, (void *) &bufHdr->tag,
HASH_REMOVE, NULL);
hash_search(LocalBufHash, &bufHdr->tag, HASH_REMOVE, NULL);
if (!hresult) /* shouldn't happen */
elog(ERROR, "local buffer hash table corrupted");
/* Mark buffer invalid */

View File

@ -608,7 +608,7 @@ LockHeldByMe(const LOCKTAG *locktag, LOCKMODE lockmode)
localtag.mode = lockmode;
locallock = (LOCALLOCK *) hash_search(LockMethodLocalHash,
(void *) &localtag,
&localtag,
HASH_FIND, NULL);
return (locallock && locallock->nLocks > 0);
@ -663,7 +663,7 @@ LockHasWaiters(const LOCKTAG *locktag, LOCKMODE lockmode, bool sessionLock)
localtag.mode = lockmode;
locallock = (LOCALLOCK *) hash_search(LockMethodLocalHash,
(void *) &localtag,
&localtag,
HASH_FIND, NULL);
/*
@ -825,7 +825,7 @@ LockAcquireExtended(const LOCKTAG *locktag,
localtag.mode = lockmode;
locallock = (LOCALLOCK *) hash_search(LockMethodLocalHash,
(void *) &localtag,
&localtag,
HASH_ENTER, &found);
/*
@ -1061,7 +1061,7 @@ LockAcquireExtended(const LOCKTAG *locktag,
dlist_delete(&proclock->lockLink);
dlist_delete(&proclock->procLink);
if (!hash_search_with_hash_value(LockMethodProcLockHash,
(void *) &(proclock->tag),
&(proclock->tag),
proclock_hashcode,
HASH_REMOVE,
NULL))
@ -1180,7 +1180,7 @@ SetupLockInTable(LockMethod lockMethodTable, PGPROC *proc,
* Find or create a lock with this tag.
*/
lock = (LOCK *) hash_search_with_hash_value(LockMethodLockHash,
(const void *) locktag,
locktag,
hashcode,
HASH_ENTER_NULL,
&found);
@ -1222,7 +1222,7 @@ SetupLockInTable(LockMethod lockMethodTable, PGPROC *proc,
* Find or create a proclock entry with this tag
*/
proclock = (PROCLOCK *) hash_search_with_hash_value(LockMethodProcLockHash,
(void *) &proclocktag,
&proclocktag,
proclock_hashcode,
HASH_ENTER_NULL,
&found);
@ -1239,7 +1239,7 @@ SetupLockInTable(LockMethod lockMethodTable, PGPROC *proc,
*/
Assert(dlist_is_empty(&(lock->procLocks)));
if (!hash_search_with_hash_value(LockMethodLockHash,
(void *) &(lock->tag),
&(lock->tag),
hashcode,
HASH_REMOVE,
NULL))
@ -1391,7 +1391,7 @@ RemoveLocalLock(LOCALLOCK *locallock)
}
if (!hash_search(LockMethodLocalHash,
(void *) &(locallock->tag),
&(locallock->tag),
HASH_REMOVE, NULL))
elog(WARNING, "locallock table corrupted");
@ -1644,7 +1644,7 @@ CleanUpLock(LOCK *lock, PROCLOCK *proclock,
dlist_delete(&proclock->procLink);
proclock_hashcode = ProcLockHashCode(&proclock->tag, hashcode);
if (!hash_search_with_hash_value(LockMethodProcLockHash,
(void *) &(proclock->tag),
&(proclock->tag),
proclock_hashcode,
HASH_REMOVE,
NULL))
@ -1660,7 +1660,7 @@ CleanUpLock(LOCK *lock, PROCLOCK *proclock,
LOCK_PRINT("CleanUpLock: deleting", lock, 0);
Assert(dlist_is_empty(&lock->procLocks));
if (!hash_search_with_hash_value(LockMethodLockHash,
(void *) &(lock->tag),
&(lock->tag),
hashcode,
HASH_REMOVE,
NULL))
@ -1998,7 +1998,7 @@ LockRelease(const LOCKTAG *locktag, LOCKMODE lockmode, bool sessionLock)
localtag.mode = lockmode;
locallock = (LOCALLOCK *) hash_search(LockMethodLocalHash,
(void *) &localtag,
&localtag,
HASH_FIND, NULL);
/*
@ -2112,7 +2112,7 @@ LockRelease(const LOCKTAG *locktag, LOCKMODE lockmode, bool sessionLock)
Assert(EligibleForRelationFastPath(locktag, lockmode));
lock = (LOCK *) hash_search_with_hash_value(LockMethodLockHash,
(const void *) locktag,
locktag,
locallock->hashcode,
HASH_FIND,
NULL);
@ -2123,7 +2123,7 @@ LockRelease(const LOCKTAG *locktag, LOCKMODE lockmode, bool sessionLock)
proclocktag.myLock = lock;
proclocktag.myProc = MyProc;
locallock->proclock = (PROCLOCK *) hash_search(LockMethodProcLockHash,
(void *) &proclocktag,
&proclocktag,
HASH_FIND,
NULL);
if (!locallock->proclock)
@ -2851,7 +2851,7 @@ FastPathGetRelationLockEntry(LOCALLOCK *locallock)
LWLockAcquire(partitionLock, LW_SHARED);
lock = (LOCK *) hash_search_with_hash_value(LockMethodLockHash,
(void *) locktag,
locktag,
locallock->hashcode,
HASH_FIND,
NULL);
@ -2864,7 +2864,7 @@ FastPathGetRelationLockEntry(LOCALLOCK *locallock)
proclock_hashcode = ProcLockHashCode(&proclocktag, locallock->hashcode);
proclock = (PROCLOCK *)
hash_search_with_hash_value(LockMethodProcLockHash,
(void *) &proclocktag,
&proclocktag,
proclock_hashcode,
HASH_FIND,
NULL);
@ -3028,7 +3028,7 @@ GetLockConflicts(const LOCKTAG *locktag, LOCKMODE lockmode, int *countp)
LWLockAcquire(partitionLock, LW_SHARED);
lock = (LOCK *) hash_search_with_hash_value(LockMethodLockHash,
(const void *) locktag,
locktag,
hashcode,
HASH_FIND,
NULL);
@ -3125,7 +3125,7 @@ LockRefindAndRelease(LockMethod lockMethodTable, PGPROC *proc,
* Re-find the lock object (it had better be there).
*/
lock = (LOCK *) hash_search_with_hash_value(LockMethodLockHash,
(void *) locktag,
locktag,
hashcode,
HASH_FIND,
NULL);
@ -3141,7 +3141,7 @@ LockRefindAndRelease(LockMethod lockMethodTable, PGPROC *proc,
proclock_hashcode = ProcLockHashCode(&proclocktag, hashcode);
proclock = (PROCLOCK *) hash_search_with_hash_value(LockMethodProcLockHash,
(void *) &proclocktag,
&proclocktag,
proclock_hashcode,
HASH_FIND,
NULL);
@ -3255,7 +3255,7 @@ CheckForSessionAndXactLocks(void)
/* Otherwise, find or make an entry in lockhtab */
hentry = (PerLockTagEntry *) hash_search(lockhtab,
(void *) &locallock->tag.lock,
&locallock->tag.lock,
HASH_ENTER, &found);
if (!found) /* initialize, if newly created */
hentry->sessLock = hentry->xactLock = false;
@ -3555,8 +3555,8 @@ PostPrepare_Locks(TransactionId xid)
* given lock with my own proc.
*/
if (!hash_update_hash_key(LockMethodProcLockHash,
(void *) proclock,
(void *) &proclocktag))
proclock,
&proclocktag))
elog(PANIC, "duplicate entry found while reassigning a prepared transaction's locks");
/* Re-link into the new proc's proclock list */
@ -4202,7 +4202,7 @@ lock_twophase_recover(TransactionId xid, uint16 info,
* Find or create a lock with this tag.
*/
lock = (LOCK *) hash_search_with_hash_value(LockMethodLockHash,
(void *) locktag,
locktag,
hashcode,
HASH_ENTER_NULL,
&found);
@ -4250,7 +4250,7 @@ lock_twophase_recover(TransactionId xid, uint16 info,
* Find or create a proclock entry with this tag
*/
proclock = (PROCLOCK *) hash_search_with_hash_value(LockMethodProcLockHash,
(void *) &proclocktag,
&proclocktag,
proclock_hashcode,
HASH_ENTER_NULL,
&found);
@ -4267,7 +4267,7 @@ lock_twophase_recover(TransactionId xid, uint16 info,
*/
Assert(dlist_is_empty(&lock->procLocks));
if (!hash_search_with_hash_value(LockMethodLockHash,
(void *) &(lock->tag),
&(lock->tag),
hashcode,
HASH_REMOVE,
NULL))
@ -4679,7 +4679,7 @@ LockWaiterCount(const LOCKTAG *locktag)
LWLockAcquire(partitionLock, LW_EXCLUSIVE);
lock = (LOCK *) hash_search_with_hash_value(LockMethodLockHash,
(const void *) locktag,
locktag,
hashcode,
HASH_FIND,
&found);

View File

@ -165,7 +165,7 @@ smgropen(RelFileLocator rlocator, BackendId backend)
brlocator.locator = rlocator;
brlocator.backend = backend;
reln = (SMgrRelation) hash_search(SMgrRelationHash,
(void *) &brlocator,
&brlocator,
HASH_ENTER, &found);
/* Initialize it if not present before */
@ -267,7 +267,7 @@ smgrclose(SMgrRelation reln)
dlist_delete(&reln->node);
if (hash_search(SMgrRelationHash,
(void *) &(reln->smgr_rlocator),
&(reln->smgr_rlocator),
HASH_REMOVE, NULL) == NULL)
elog(ERROR, "SMgrRelation hashtable corrupted");
@ -352,7 +352,7 @@ smgrcloserellocator(RelFileLocatorBackend rlocator)
return;
reln = (SMgrRelation) hash_search(SMgrRelationHash,
(void *) &rlocator,
&rlocator,
HASH_FIND, NULL);
if (reln != NULL)
smgrclose(reln);

View File

@ -501,7 +501,7 @@ RememberSyncRequest(const FileTag *ftag, SyncRequestType type)
/* Cancel previously entered request */
entry = (PendingFsyncEntry *) hash_search(pendingOps,
(void *) ftag,
ftag,
HASH_FIND,
NULL);
if (entry != NULL)
@ -557,7 +557,7 @@ RememberSyncRequest(const FileTag *ftag, SyncRequestType type)
Assert(type == SYNC_REQUEST);
entry = (PendingFsyncEntry *) hash_search(pendingOps,
(void *) ftag,
ftag,
HASH_ENTER,
&found);
/* if new entry, or was previously canceled, initialize it */

View File

@ -254,7 +254,7 @@ compute_tsvector_stats(VacAttrStats *stats,
/* Lookup current lexeme in hashtable, adding it if new */
item = (TrackItem *) hash_search(lexemes_tab,
(const void *) &hash_key,
&hash_key,
HASH_ENTER, &found);
if (found)
@ -464,7 +464,7 @@ prune_lexemes_hashtable(HTAB *lexemes_tab, int b_current)
{
char *lexeme = item->key.lexeme;
if (hash_search(lexemes_tab, (const void *) &item->key,
if (hash_search(lexemes_tab, &item->key,
HASH_REMOVE, NULL) == NULL)
elog(ERROR, "hash table corrupted");
pfree(lexeme);

View File

@ -362,7 +362,7 @@ compute_array_stats(VacAttrStats *stats, AnalyzeAttrFetchFunc fetchfunc,
/* Lookup current element in hashtable, adding it if new */
elem_value = elem_values[j];
item = (TrackItem *) hash_search(elements_tab,
(const void *) &elem_value,
&elem_value,
HASH_ENTER, &found);
if (found)
@ -690,7 +690,7 @@ prune_element_hashtable(HTAB *elements_tab, int b_current)
{
Datum value = item->key;
if (hash_search(elements_tab, (const void *) &item->key,
if (hash_search(elements_tab, &item->key,
HASH_REMOVE, NULL) == NULL)
elog(ERROR, "hash table corrupted");
/* We should free memory if element is not passed by value */

View File

@ -2129,7 +2129,7 @@ ri_LoadConstraintInfo(Oid constraintOid)
* Find or create a hash entry. If we find a valid one, just return it.
*/
riinfo = (RI_ConstraintInfo *) hash_search(ri_constraint_cache,
(void *) &constraintOid,
&constraintOid,
HASH_ENTER, &found);
if (!found)
riinfo->valid = false;
@ -2724,7 +2724,7 @@ ri_FetchPreparedPlan(RI_QueryKey *key)
* Lookup for the key
*/
entry = (RI_QueryHashEntry *) hash_search(ri_query_cache,
(void *) key,
key,
HASH_FIND, NULL);
if (entry == NULL)
return NULL;
@ -2777,7 +2777,7 @@ ri_HashPreparedPlan(RI_QueryKey *key, SPIPlanPtr plan)
* invalid by ri_FetchPreparedPlan.
*/
entry = (RI_QueryHashEntry *) hash_search(ri_query_cache,
(void *) key,
key,
HASH_ENTER, &found);
Assert(!found || entry->plan == NULL);
entry->plan = plan;
@ -2927,7 +2927,7 @@ ri_HashCompareOp(Oid eq_opr, Oid typeid)
key.eq_opr = eq_opr;
key.typeid = typeid;
entry = (RI_CompareHashEntry *) hash_search(ri_compare_cache,
(void *) &key,
&key,
HASH_ENTER, &found);
if (!found)
entry->valid = false;

View File

@ -63,7 +63,7 @@ InvalidateAttoptCacheCallback(Datum arg, int cacheid, uint32 hashvalue)
if (attopt->opts)
pfree(attopt->opts);
if (hash_search(AttoptCacheHash,
(void *) &attopt->key,
&attopt->key,
HASH_REMOVE,
NULL) == NULL)
elog(ERROR, "hash table corrupted");
@ -116,7 +116,7 @@ get_attribute_options(Oid attrelid, int attnum)
key.attnum = attnum;
attopt =
(AttoptCacheEntry *) hash_search(AttoptCacheHash,
(void *) &key,
&key,
HASH_FIND,
NULL);
@ -163,7 +163,7 @@ get_attribute_options(Oid attrelid, int attnum)
* pg_attribute, since the read could cause a cache flush.
*/
attopt = (AttoptCacheEntry *) hash_search(AttoptCacheHash,
(void *) &key,
&key,
HASH_ENTER,
NULL);
attopt->opts = opts;

View File

@ -210,7 +210,7 @@ static int EOXactTupleDescArrayLen = 0;
do { \
RelIdCacheEnt *hentry; bool found; \
hentry = (RelIdCacheEnt *) hash_search(RelationIdCache, \
(void *) &((RELATION)->rd_id), \
&((RELATION)->rd_id), \
HASH_ENTER, &found); \
if (found) \
{ \
@ -232,7 +232,7 @@ do { \
do { \
RelIdCacheEnt *hentry; \
hentry = (RelIdCacheEnt *) hash_search(RelationIdCache, \
(void *) &(ID), \
&(ID), \
HASH_FIND, NULL); \
if (hentry) \
RELATION = hentry->reldesc; \
@ -244,7 +244,7 @@ do { \
do { \
RelIdCacheEnt *hentry; \
hentry = (RelIdCacheEnt *) hash_search(RelationIdCache, \
(void *) &((RELATION)->rd_id), \
&((RELATION)->rd_id), \
HASH_REMOVE, NULL); \
if (hentry == NULL) \
elog(WARNING, "failed to delete relcache entry for OID %u", \
@ -1663,7 +1663,7 @@ LookupOpclassInfo(Oid operatorClassOid,
}
opcentry = (OpClassCacheEnt *) hash_search(OpClassCache,
(void *) &operatorClassOid,
&operatorClassOid,
HASH_ENTER, &found);
if (!found)
@ -3210,7 +3210,7 @@ AtEOXact_RelationCache(bool isCommit)
for (i = 0; i < eoxact_list_len; i++)
{
idhentry = (RelIdCacheEnt *) hash_search(RelationIdCache,
(void *) &eoxact_list[i],
&eoxact_list[i],
HASH_FIND,
NULL);
if (idhentry != NULL)
@ -3359,7 +3359,7 @@ AtEOSubXact_RelationCache(bool isCommit, SubTransactionId mySubid,
for (i = 0; i < eoxact_list_len; i++)
{
idhentry = (RelIdCacheEnt *) hash_search(RelationIdCache,
(void *) &eoxact_list[i],
&eoxact_list[i],
HASH_FIND,
NULL);
if (idhentry != NULL)

View File

@ -72,7 +72,7 @@ RelfilenumberMapInvalidateCallback(Datum arg, Oid relid)
entry->relid == relid) /* individual flushed relation */
{
if (hash_search(RelfilenumberMapHash,
(void *) &entry->key,
&entry->key,
HASH_REMOVE,
NULL) == NULL)
elog(ERROR, "hash table corrupted");
@ -164,7 +164,7 @@ RelidByRelfilenumber(Oid reltablespace, RelFileNumber relfilenumber)
* since querying invalid values isn't supposed to be a frequent thing,
* but it's basically free.
*/
entry = hash_search(RelfilenumberMapHash, (void *) &key, HASH_FIND, &found);
entry = hash_search(RelfilenumberMapHash, &key, HASH_FIND, &found);
if (found)
return entry->relid;
@ -235,7 +235,7 @@ RelidByRelfilenumber(Oid reltablespace, RelFileNumber relfilenumber)
* caused cache invalidations to be executed which would have deleted a
* new entry if we had entered it above.
*/
entry = hash_search(RelfilenumberMapHash, (void *) &key, HASH_ENTER, &found);
entry = hash_search(RelfilenumberMapHash, &key, HASH_ENTER, &found);
if (found)
elog(ERROR, "corrupted hashtable");
entry->relid = relid;

View File

@ -63,7 +63,7 @@ InvalidateTableSpaceCacheCallback(Datum arg, int cacheid, uint32 hashvalue)
if (spc->opts)
pfree(spc->opts);
if (hash_search(TableSpaceCacheHash,
(void *) &spc->oid,
&spc->oid,
HASH_REMOVE,
NULL) == NULL)
elog(ERROR, "hash table corrupted");
@ -121,7 +121,7 @@ get_tablespace(Oid spcid)
if (!TableSpaceCacheHash)
InitializeTableSpaceCache();
spc = (TableSpaceCacheEntry *) hash_search(TableSpaceCacheHash,
(void *) &spcid,
&spcid,
HASH_FIND,
NULL);
if (spc)
@ -163,7 +163,7 @@ get_tablespace(Oid spcid)
* flush.
*/
spc = (TableSpaceCacheEntry *) hash_search(TableSpaceCacheHash,
(void *) &spcid,
&spcid,
HASH_ENTER,
NULL);
spc->opts = opts;

View File

@ -139,7 +139,7 @@ lookup_ts_parser_cache(Oid prsId)
/* Try to look up an existing entry */
entry = (TSParserCacheEntry *) hash_search(TSParserCacheHash,
(void *) &prsId,
&prsId,
HASH_FIND, NULL);
if (entry == NULL || !entry->isvalid)
{
@ -172,9 +172,7 @@ lookup_ts_parser_cache(Oid prsId)
/* Now make the cache entry */
entry = (TSParserCacheEntry *)
hash_search(TSParserCacheHash,
(void *) &prsId,
HASH_ENTER, &found);
hash_search(TSParserCacheHash, &prsId, HASH_ENTER, &found);
Assert(!found); /* it wasn't there a moment ago */
}
@ -238,7 +236,7 @@ lookup_ts_dictionary_cache(Oid dictId)
/* Try to look up an existing entry */
entry = (TSDictionaryCacheEntry *) hash_search(TSDictionaryCacheHash,
(void *) &dictId,
&dictId,
HASH_FIND, NULL);
if (entry == NULL || !entry->isvalid)
{
@ -288,7 +286,7 @@ lookup_ts_dictionary_cache(Oid dictId)
/* Now make the cache entry */
entry = (TSDictionaryCacheEntry *)
hash_search(TSDictionaryCacheHash,
(void *) &dictId,
&dictId,
HASH_ENTER, &found);
Assert(!found); /* it wasn't there a moment ago */
@ -401,7 +399,7 @@ lookup_ts_config_cache(Oid cfgId)
/* Try to look up an existing entry */
entry = (TSConfigCacheEntry *) hash_search(TSConfigCacheHash,
(void *) &cfgId,
&cfgId,
HASH_FIND, NULL);
if (entry == NULL || !entry->isvalid)
{
@ -441,7 +439,7 @@ lookup_ts_config_cache(Oid cfgId)
/* Now make the cache entry */
entry = (TSConfigCacheEntry *)
hash_search(TSConfigCacheHash,
(void *) &cfgId,
&cfgId,
HASH_ENTER, &found);
Assert(!found); /* it wasn't there a moment ago */
}

View File

@ -364,7 +364,7 @@ lookup_type_cache(Oid type_id, int flags)
/* Try to look up an existing entry */
typentry = (TypeCacheEntry *) hash_search(TypeCacheHash,
(void *) &type_id,
&type_id,
HASH_FIND, NULL);
if (typentry == NULL)
{
@ -392,7 +392,7 @@ lookup_type_cache(Oid type_id, int flags)
/* Now make the typcache entry */
typentry = (TypeCacheEntry *) hash_search(TypeCacheHash,
(void *) &type_id,
&type_id,
HASH_ENTER, &found);
Assert(!found); /* it wasn't there a moment ago */
@ -1974,7 +1974,7 @@ assign_record_type_typmod(TupleDesc tupDesc)
* the allocations succeed before we create the new entry.
*/
recentry = (RecordCacheEntry *) hash_search(RecordCacheHash,
(void *) &tupDesc,
&tupDesc,
HASH_FIND, &found);
if (found && recentry->tupdesc != NULL)
{
@ -2012,7 +2012,7 @@ assign_record_type_typmod(TupleDesc tupDesc)
/* Fully initialized; create the hash table entry */
recentry = (RecordCacheEntry *) hash_search(RecordCacheHash,
(void *) &tupDesc,
&tupDesc,
HASH_ENTER, NULL);
recentry->tupdesc = entDesc;

View File

@ -253,7 +253,7 @@ GetComboCommandId(CommandId cmin, CommandId cmax)
key.cmin = cmin;
key.cmax = cmax;
entry = (ComboCidEntry) hash_search(comboHash,
(void *) &key,
&key,
HASH_ENTER,
&found);

View File

@ -2627,7 +2627,7 @@ plpgsql_HashTableLookup(PLpgSQL_func_hashkey *func_key)
plpgsql_HashEnt *hentry;
hentry = (plpgsql_HashEnt *) hash_search(plpgsql_HashTable,
(void *) func_key,
func_key,
HASH_FIND,
NULL);
if (hentry)
@ -2644,7 +2644,7 @@ plpgsql_HashTableInsert(PLpgSQL_function *function,
bool found;
hentry = (plpgsql_HashEnt *) hash_search(plpgsql_HashTable,
(void *) func_key,
func_key,
HASH_ENTER,
&found);
if (found)
@ -2665,7 +2665,7 @@ plpgsql_HashTableDelete(PLpgSQL_function *function)
return;
hentry = (plpgsql_HashEnt *) hash_search(plpgsql_HashTable,
(void *) function->fn_hashkey,
function->fn_hashkey,
HASH_REMOVE,
NULL);
if (hentry == NULL)

View File

@ -7775,7 +7775,7 @@ get_cast_hashentry(PLpgSQL_execstate *estate,
cast_key.srctypmod = srctypmod;
cast_key.dsttypmod = dsttypmod;
cast_entry = (plpgsql_CastHashEntry *) hash_search(estate->cast_hash,
(void *) &cast_key,
&cast_key,
HASH_ENTER, &found);
if (!found) /* initialize if new entry */
cast_entry->cast_cexpr = NULL;