Avoid unncessary always true test (src/backend/storage/buffer/bufmgr.c)

From: Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>
To: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Avoid unncessary always true test (src/backend/storage/buffer/bufmgr.c)
Date: 2023-06-04 12:42:22
Message-ID: CAEudQAoSA7saBF7RaoYbRjE+Zojojin0Qc9A4hebPKB8o1J+EQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

Per Coverity.

At function ExtendBufferedRelShared, has a always true test.
eb.rel was dereferenced one line above, so in
if (eb.rel) is always true.

I think it's worth removing the test, because Coverity raises dozens of
alerts thinking eb.rel might be NULL.
Besides, one less test is one less branch.

regards,
Ranier Vilela

Attachment Content-Type Size
avoid-unncessary-always-test-true.patch application/octet-stream 475 bytes

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2023-06-04 16:48:47 Re: Wrong syntax in feature description
Previous Message Ranier Vilela 2023-06-04 11:59:00 Re: Avoid unused value (src/fe_utils/print.c)