mirror of
https://github.com/postgres/postgres.git
synced 2025-12-22 17:42:17 +03:00
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:
@@ -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 */
|
||||
|
||||
@@ -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;
|
||||
|
||||
6
src/backend/utils/cache/attoptcache.c
vendored
6
src/backend/utils/cache/attoptcache.c
vendored
@@ -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;
|
||||
|
||||
12
src/backend/utils/cache/relcache.c
vendored
12
src/backend/utils/cache/relcache.c
vendored
@@ -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)
|
||||
|
||||
6
src/backend/utils/cache/relfilenumbermap.c
vendored
6
src/backend/utils/cache/relfilenumbermap.c
vendored
@@ -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;
|
||||
|
||||
6
src/backend/utils/cache/spccache.c
vendored
6
src/backend/utils/cache/spccache.c
vendored
@@ -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;
|
||||
|
||||
14
src/backend/utils/cache/ts_cache.c
vendored
14
src/backend/utils/cache/ts_cache.c
vendored
@@ -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 */
|
||||
}
|
||||
|
||||
8
src/backend/utils/cache/typcache.c
vendored
8
src/backend/utils/cache/typcache.c
vendored
@@ -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;
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user