Commit ef581f05 authored by Bruce Momjian's avatar Bruce Momjian

Rewrite for-loop, because this is not the Obfuscated C Code Contest.

Manfred Koizar
parent bcf7a35f
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/page/bufpage.c,v 1.50 2002/09/04 20:31:26 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/storage/page/bufpage.c,v 1.51 2003/01/11 05:01:03 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -409,8 +409,7 @@ PageIndexTupleDelete(Page page, OffsetNumber offnum) ...@@ -409,8 +409,7 @@ PageIndexTupleDelete(Page page, OffsetNumber offnum)
unsigned offset; unsigned offset;
int nbytes; int nbytes;
int offidx; int offidx;
int nline, int nline;
i;
/* /*
* As with PageRepairFragmentation, paranoia seems justified. * As with PageRepairFragmentation, paranoia seems justified.
...@@ -479,11 +478,12 @@ PageIndexTupleDelete(Page page, OffsetNumber offnum) ...@@ -479,11 +478,12 @@ PageIndexTupleDelete(Page page, OffsetNumber offnum)
*/ */
if (!PageIsEmpty(page)) if (!PageIsEmpty(page))
{ {
int i;
nline--; /* there's one less than when we started */ nline--; /* there's one less than when we started */
for (i = nline; --i >= 0;) for (i = 1; i <= nline; i++)
{ {
if (PageGetItemId(phdr, i + 1)->lp_off <= offset) if (PageGetItemId(phdr, i)->lp_off <= offset)
PageGetItemId(phdr, i + 1)->lp_off += size; PageGetItemId(phdr, i)->lp_off += size;
} }
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment