aboutsummaryrefslogtreecommitdiff
path: root/src/backend/commands/async.c
diff options
context:
space:
mode:
authorJohn Naylor <john.naylor@postgresql.org>2023-11-30 15:25:57 +0700
committerJohn Naylor <john.naylor@postgresql.org>2023-11-30 15:25:57 +0700
commit095d109ccd76ca4c46c4ea2be30d63d70361c5f9 (patch)
tree70d43b54aec0ea4e0d3a2521ca7dfa58c9f1ff1b /src/backend/commands/async.c
parent489ca33081c8f590a314d4a09d9bee56a81f1a85 (diff)
downloadpostgresql-095d109ccd76ca4c46c4ea2be30d63d70361c5f9.tar.gz
postgresql-095d109ccd76ca4c46c4ea2be30d63d70361c5f9.zip
Remove redundant setting of hashkey after insertion
It's not necessary to fill the key field in most cases, since hash_search has already done that. Some existing call sites have an assert or comment that this contract has been fulfilled, but those are quite old and that practice seems unnecessary here. While at it, remove a nearby redundant assignment that a smart compiler will elide anyway. Zhao Junwang, with some adjustments by me Reviewed by Nathan Bossart, with additional feedback from Tom Lane Discussion: http://postgr.es/m/CAEG8a3%2BUPF%3DR2QGPgJMF2mKh8xPd1H2TmfH77zPuVUFdBpiGUA%40mail.gmail.com
Diffstat (limited to 'src/backend/commands/async.c')
-rw-r--r--src/backend/commands/async.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/src/backend/commands/async.c b/src/backend/commands/async.c
index 2651d8904b6..264f25a8f9c 100644
--- a/src/backend/commands/async.c
+++ b/src/backend/commands/async.c
@@ -2305,15 +2305,13 @@ AddEventToPendingNotifies(Notification *n)
foreach(l, pendingNotifies->events)
{
Notification *oldn = (Notification *) lfirst(l);
- NotificationHash *hentry;
bool found;
- hentry = (NotificationHash *) hash_search(pendingNotifies->hashtab,
- &oldn,
- HASH_ENTER,
- &found);
+ (void) hash_search(pendingNotifies->hashtab,
+ &oldn,
+ HASH_ENTER,
+ &found);
Assert(!found);
- hentry->event = oldn;
}
}
@@ -2323,15 +2321,13 @@ AddEventToPendingNotifies(Notification *n)
/* Add event to the hash table if needed */
if (pendingNotifies->hashtab != NULL)
{
- NotificationHash *hentry;
bool found;
- hentry = (NotificationHash *) hash_search(pendingNotifies->hashtab,
- &n,
- HASH_ENTER,
- &found);
+ (void) hash_search(pendingNotifies->hashtab,
+ &n,
+ HASH_ENTER,
+ &found);
Assert(!found);
- hentry->event = n;
}
}