From 3fcf3d938fe7d86d1c2f5171fead7a002b515b24 Mon Sep 17 00:00:00 2001
From: Zian Wang <Yaphters@gmail.com>
Date: Tue, 2 May 2023 18:58:15 -0400
Subject: [PATCH v=1] Rename 'lpp' to 'lp' in heapam.c

In heapam.c we use a mixture of 'lpp'(13/125) and 'lp'(112/125) for the ItemId variable to iterate over the line pointer array. This is confusing as they represent the same thing. Previously there was code like '++lpp' and technically 'lpp' makes more sense because we are incrementing the line pointer's pointer(lpp) but not the line pointer(lp) itself.

Since 1. we have removed all the '++lpp' and now only increment lineoff during iteration and 2. there are 100+ more occurrences of 'lp' than 'lpp', I suggest we make the naming consistent by changing all the 'lpp' to 'lp' to avoid confusion.
---
 src/backend/access/heap/heapam.c | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/src/backend/access/heap/heapam.c b/src/backend/access/heap/heapam.c
index 0124f37..21371e0 100644
--- a/src/backend/access/heap/heapam.c
+++ b/src/backend/access/heap/heapam.c
@@ -453,16 +453,16 @@ heapgetpage(TableScanDesc sscan, BlockNumber block)
 
 	for (lineoff = FirstOffsetNumber; lineoff <= lines; lineoff++)
 	{
-		ItemId		lpp = PageGetItemId(page, lineoff);
+		ItemId		lp = PageGetItemId(page, lineoff);
 		HeapTupleData loctup;
 		bool		valid;
 
-		if (!ItemIdIsNormal(lpp))
+		if (!ItemIdIsNormal(lp))
 			continue;
 
 		loctup.t_tableOid = RelationGetRelid(scan->rs_base.rs_rd);
-		loctup.t_data = (HeapTupleHeader) PageGetItem(page, lpp);
-		loctup.t_len = ItemIdGetLength(lpp);
+		loctup.t_data = (HeapTupleHeader) PageGetItem(page, lp);
+		loctup.t_len = ItemIdGetLength(lp);
 		ItemPointerSet(&(loctup.t_self), block, lineoff);
 
 		if (all_visible)
@@ -775,13 +775,13 @@ continue_page:
 		for (; linesleft > 0; linesleft--, lineoff += dir)
 		{
 			bool		visible;
-			ItemId		lpp = PageGetItemId(page, lineoff);
+			ItemId		lp = PageGetItemId(page, lineoff);
 
-			if (!ItemIdIsNormal(lpp))
+			if (!ItemIdIsNormal(lp))
 				continue;
 
-			tuple->t_data = (HeapTupleHeader) PageGetItem(page, lpp);
-			tuple->t_len = ItemIdGetLength(lpp);
+			tuple->t_data = (HeapTupleHeader) PageGetItem(page, lp);
+			tuple->t_len = ItemIdGetLength(lp);
 			ItemPointerSet(&(tuple->t_self), block, lineoff);
 
 			visible = HeapTupleSatisfiesVisibility(tuple,
@@ -893,15 +893,15 @@ continue_page:
 
 		for (; linesleft > 0; linesleft--, lineindex += dir)
 		{
-			ItemId		lpp;
+			ItemId		lp;
 			OffsetNumber lineoff;
 
 			lineoff = scan->rs_vistuples[lineindex];
-			lpp = PageGetItemId(page, lineoff);
-			Assert(ItemIdIsNormal(lpp));
+			lp = PageGetItemId(page, lineoff);
+			Assert(ItemIdIsNormal(lp));
 
-			tuple->t_data = (HeapTupleHeader) PageGetItem(page, lpp);
-			tuple->t_len = ItemIdGetLength(lpp);
+			tuple->t_data = (HeapTupleHeader) PageGetItem(page, lp);
+			tuple->t_len = ItemIdGetLength(lp);
 			ItemPointerSet(&(tuple->t_self), block, lineoff);
 
 			/* skip any tuples that don't match the scan key */
-- 
2.34.1

