pgsql: nbtree: Remove useless local variables. - Mailing list pgsql-committers

From Peter Geoghegan
Subject pgsql: nbtree: Remove useless local variables.
Date
Msg-id E1jENgQ-0003BF-63@gemulon.postgresql.org
Whole thread Raw
List 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(-)


pgsql-committers by date:

Previous
From: Thomas Munro
Date:
Subject: Re: pgsql: Add kqueue(2) support to the WaitEventSet API.
Next
From: Amit Kapila
Date:
Subject: pgsql: Assert that we don't acquire a heavyweight lock on another objec