diff options
author | Peter Eisentraut | 2023-02-06 08:05:20 +0000 |
---|---|---|
committer | Peter Eisentraut | 2023-02-06 08:41:01 +0000 |
commit | 54a177a948b0a773c25c6737d1cc3cc49222a526 (patch) | |
tree | a442be10d2b8515f6b1600f60838e379ee546fe8 /src/backend/utils | |
parent | 009f8d17146da72478fcb8f544b793c443fa254c (diff) |
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 5999e78fc45dcb91784b64b6e9ae43f4e4f68ca2).
Since after this there is some more horizontal space available, do
some light reformatting where suitable.
Reviewed-by: Corey Huinker <[email protected]>
Discussion: https://www.postgresql.org/message-id/flat/fd9adf5d-b1aa-e82f-e4c7-263c30145807%40enterprisedb.com
Diffstat (limited to 'src/backend/utils')
-rw-r--r-- | src/backend/utils/adt/array_typanalyze.c | 4 | ||||
-rw-r--r-- | src/backend/utils/adt/ri_triggers.c | 8 | ||||
-rw-r--r-- | src/backend/utils/cache/attoptcache.c | 6 | ||||
-rw-r--r-- | src/backend/utils/cache/relcache.c | 12 | ||||
-rw-r--r-- | src/backend/utils/cache/relfilenumbermap.c | 6 | ||||
-rw-r--r-- | src/backend/utils/cache/spccache.c | 6 | ||||
-rw-r--r-- | src/backend/utils/cache/ts_cache.c | 14 | ||||
-rw-r--r-- | src/backend/utils/cache/typcache.c | 8 | ||||
-rw-r--r-- | src/backend/utils/time/combocid.c | 2 |
9 files changed, 32 insertions, 34 deletions
diff --git a/src/backend/utils/adt/array_typanalyze.c b/src/backend/utils/adt/array_typanalyze.c index 5841d7d6fcb..52e160d6bbb 100644 --- a/src/backend/utils/adt/array_typanalyze.c +++ b/src/backend/utils/adt/array_typanalyze.c @@ -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 */ diff --git a/src/backend/utils/adt/ri_triggers.c b/src/backend/utils/adt/ri_triggers.c index 995571ae044..375b17b9f3b 100644 --- a/src/backend/utils/adt/ri_triggers.c +++ b/src/backend/utils/adt/ri_triggers.c @@ -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; diff --git a/src/backend/utils/cache/attoptcache.c b/src/backend/utils/cache/attoptcache.c index 28a99f0fc42..6769d4765b1 100644 --- a/src/backend/utils/cache/attoptcache.c +++ b/src/backend/utils/cache/attoptcache.c @@ -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; diff --git a/src/backend/utils/cache/relcache.c b/src/backend/utils/cache/relcache.c index d171cfcf2fc..dfda0ab7d69 100644 --- a/src/backend/utils/cache/relcache.c +++ b/src/backend/utils/cache/relcache.c @@ -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) diff --git a/src/backend/utils/cache/relfilenumbermap.c b/src/backend/utils/cache/relfilenumbermap.c index 57c32547959..220f33d43f5 100644 --- a/src/backend/utils/cache/relfilenumbermap.c +++ b/src/backend/utils/cache/relfilenumbermap.c @@ -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; diff --git a/src/backend/utils/cache/spccache.c b/src/backend/utils/cache/spccache.c index aabe6ba64b1..136fd737d37 100644 --- a/src/backend/utils/cache/spccache.c +++ b/src/backend/utils/cache/spccache.c @@ -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; diff --git a/src/backend/utils/cache/ts_cache.c b/src/backend/utils/cache/ts_cache.c index 519fa9fa731..7760ad764ea 100644 --- a/src/backend/utils/cache/ts_cache.c +++ b/src/backend/utils/cache/ts_cache.c @@ -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 */ } diff --git a/src/backend/utils/cache/typcache.c b/src/backend/utils/cache/typcache.c index 4a3e0fdb7fe..ed6360ce2b9 100644 --- a/src/backend/utils/cache/typcache.c +++ b/src/backend/utils/cache/typcache.c @@ -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; diff --git a/src/backend/utils/time/combocid.c b/src/backend/utils/time/combocid.c index c7124d284fa..0e94bc93f74 100644 --- a/src/backend/utils/time/combocid.c +++ b/src/backend/utils/time/combocid.c @@ -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); |