pgsql: nbtree: Remove useless local variables.

From: Peter Geoghegan <pg(at)bowt(dot)ie>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: nbtree: Remove useless local variables.
Date: 2020-03-18 01:39:46
Message-ID: E1jENgQ-0003BF-63@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

nbtree: Remove useless local variables.

Copying block and offset numbers to local variables in _bt_insertonpg()
made the code less readable. Remove the variables. There is already
code that conditionally calls BufferGetBlockNumber() in the same block,
so consistently do it that way instead.

Calling BufferGetBlockNumber() is very cheap, but we might as well avoid
it when it isn't truly necessary. It isn't truly necessary for
_bt_insertonpg() to call BufferGetBlockNumber() in almost all cases.

Spotted while working on a patch that refactors the fastpath rightmost
leaf page cache optimization, which was added by commit 2b272734.

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/b897b3aae6b525922fe3d074d4bdf5f2674954dd

Modified Files
--------------
src/backend/access/nbtree/nbtinsert.c | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Amit Kapila 2020-03-18 01:58:33 pgsql: Assert that we don't acquire a heavyweight lock on another objec
Previous Message Thomas Munro 2020-03-18 00:07:10 Re: pgsql: Add kqueue(2) support to the WaitEventSet API.