Skip to content

Commit ef581f0

Browse files
committed
Rewrite for-loop, because this is not the Obfuscated C Code Contest.
Manfred Koizar
1 parent bcf7a35 commit ef581f0

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/backend/storage/page/bufpage.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/storage/page/bufpage.c,v 1.50 2002/09/04 20:31:26 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/storage/page/bufpage.c,v 1.51 2003/01/11 05:01:03 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -409,8 +409,7 @@ PageIndexTupleDelete(Page page, OffsetNumber offnum)
409409
unsigned offset;
410410
int nbytes;
411411
int offidx;
412-
int nline,
413-
i;
412+
int nline;
414413

415414
/*
416415
* As with PageRepairFragmentation, paranoia seems justified.
@@ -479,11 +478,12 @@ PageIndexTupleDelete(Page page, OffsetNumber offnum)
479478
*/
480479
if (!PageIsEmpty(page))
481480
{
481+
int i;
482482
nline--; /* there's one less than when we started */
483-
for (i = nline; --i >= 0;)
483+
for (i = 1; i <= nline; i++)
484484
{
485-
if (PageGetItemId(phdr, i + 1)->lp_off <= offset)
486-
PageGetItemId(phdr, i + 1)->lp_off += size;
485+
if (PageGetItemId(phdr, i)->lp_off <= offset)
486+
PageGetItemId(phdr, i)->lp_off += size;
487487
}
488488
}
489489
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy