Remove redundant variable pageSize in gistinitpage

Started by Bharath Rupireddyover 4 years ago2 messages
#1Bharath Rupireddy
bharath.rupireddyforpostgres@gmail.com
1 attachment(s)

Hi,

In gistinitpage, pageSize variable looks redundant, instead we could
just pass BLCKSZ. This will be consistent with its peers
BloomInitPage, brin_page_init and SpGistInitPage. Attaching a small
patch. Thoughts?

With Regards,
Bharath Rupireddy.
EnterpriseDB: http://www.enterprisedb.com

Attachments:

v1-0001-Remove-redundant-variable-pageSize-in-gistinitpag.patchapplication/x-patch; name=v1-0001-Remove-redundant-variable-pageSize-in-gistinitpag.patchDownload
From b77d8d445ebf7c0a00b4931c0f346d2bffb64a61 Mon Sep 17 00:00:00 2001
From: Bharath Rupireddy <bharath.rupireddy@enterprisedb.com>
Date: Sun, 25 Apr 2021 19:51:06 +0530
Subject: [PATCH v1] Remove redundant variable pageSize in gistinitpage

In gistinitpage, pageSize variable looks redundant, instead just
pass BLCKSZ. This will be consistent with its peers BloomInitPage,
brin_page_init and SpGistInitPage.
---
 src/backend/access/gist/gistutil.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/backend/access/gist/gistutil.c b/src/backend/access/gist/gistutil.c
index 8dcd53c457..43ba03b6eb 100644
--- a/src/backend/access/gist/gistutil.c
+++ b/src/backend/access/gist/gistutil.c
@@ -756,9 +756,8 @@ void
 gistinitpage(Page page, uint32 f)
 {
 	GISTPageOpaque opaque;
-	Size		pageSize = BLCKSZ;
 
-	PageInit(page, pageSize, sizeof(GISTPageOpaqueData));
+	PageInit(page, BLCKSZ, sizeof(GISTPageOpaqueData));
 
 	opaque = GistPageGetOpaque(page);
 	opaque->rightlink = InvalidBlockNumber;
-- 
2.25.1

#2Peter Eisentraut
peter.eisentraut@enterprisedb.com
In reply to: Bharath Rupireddy (#1)
Re: Remove redundant variable pageSize in gistinitpage

On 26.04.21 05:12, Bharath Rupireddy wrote:

In gistinitpage, pageSize variable looks redundant, instead we could
just pass BLCKSZ. This will be consistent with its peers
BloomInitPage, brin_page_init and SpGistInitPage. Attaching a small
patch. Thoughts?

Committed.

This code was new in this form in PG14
(16fa9b2b30a357b4aea982bd878ec2e5e002dbcc), so it made sense to clean it
up now.