mirror of
https://github.com/postgres/postgres.git
synced 2025-04-29 13:56:47 +03:00
Rewrite for-loop, because this is not the Obfuscated C Code Contest.
Manfred Koizar
This commit is contained in:
parent
bcf7a35f3c
commit
ef581f0552
@ -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)
|
|||||||
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)
|
|||||||
*/
|
*/
|
||||||
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user