aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>2024-08-11 20:21:16 +0300
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>2024-08-11 20:21:16 +0300
commitf011e82c2c886329245f821146c560a3607f7aba (patch)
tree9762a9ec761c6e03fe517bc9cdd6ab5df24752d0 /src
parentb2be5cb2ab671073ec0fc69357c3c11e25bb41cc (diff)
downloadpostgresql-f011e82c2c886329245f821146c560a3607f7aba.tar.gz
postgresql-f011e82c2c886329245f821146c560a3607f7aba.zip
Initialize HASHCTL differently, to suppress Coverity warning
Coverity complained that the hash_create() call might access hash_table_ctl->hctl. That's a false alarm, hash_create() only accesses that field when passed the HASH_SHARED_MEM flag. Try to silence it by using a plain local variable instead of a const. That's how the HASHCTL is initialized in all the other hash_create() calls.
Diffstat (limited to 'src')
-rw-r--r--src/backend/access/transam/xlogprefetcher.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/backend/access/transam/xlogprefetcher.c b/src/backend/access/transam/xlogprefetcher.c
index 2dc2fb760a2..ecd794148c5 100644
--- a/src/backend/access/transam/xlogprefetcher.c
+++ b/src/backend/access/transam/xlogprefetcher.c
@@ -362,17 +362,15 @@ XLogPrefetcher *
XLogPrefetcherAllocate(XLogReaderState *reader)
{
XLogPrefetcher *prefetcher;
- const HASHCTL hash_table_ctl = {
- .keysize = sizeof(RelFileLocator),
- .entrysize = sizeof(XLogPrefetcherFilter)
- };
+ HASHCTL ctl;
prefetcher = palloc0(sizeof(XLogPrefetcher));
-
prefetcher->reader = reader;
+
+ ctl.keysize = sizeof(RelFileLocator);
+ ctl.entrysize = sizeof(XLogPrefetcherFilter);
prefetcher->filter_table = hash_create("XLogPrefetcherFilterTable", 1024,
- &hash_table_ctl,
- HASH_ELEM | HASH_BLOBS);
+ &ctl, HASH_ELEM | HASH_BLOBS);
dlist_init(&prefetcher->filter_queue);
SharedStats->wal_distance = 0;