mirror of
https://github.com/postgres/postgres.git
synced 2025-11-04 20:11:56 +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:
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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user