Re: Small stylistic change

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Manfred Koizar <mkoi-pg(at)aon(dot)at>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: Small stylistic change
Date: 2003-01-09 01:16:37
Message-ID: 200301090116.h091Gbo21682@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches


Your patch has been added to the PostgreSQL unapplied patches list at:

http://momjian.postgresql.org/cgi-bin/pgpatches

I will try to apply it within the next 48 hours.

---------------------------------------------------------------------------

Manfred Koizar wrote:
> Rewrite for-loop, because this is not the Obfuscated C Code Contest.
>
> Servus
> Manfred

> diff -ruN ../base/src/backend/storage/page/bufpage.c ./src/backend/storage/page/bufpage.c
> --- ../base/src/backend/storage/page/bufpage.c 2002-09-04 22:31:26.000000000 +0200
> +++ ./src/backend/storage/page/bufpage.c 2003-01-06 18:07:09.000000000 +0100
> @@ -409,8 +409,7 @@
> unsigned offset;
> int nbytes;
> int offidx;
> - int nline,
> - i;
> + int nline;
>
> /*
> * As with PageRepairFragmentation, paranoia seems justified.
> @@ -479,11 +478,12 @@
> */
> if (!PageIsEmpty(page))
> {
> + int i;
> 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)
> - PageGetItemId(phdr, i + 1)->lp_off += size;
> + if (PageGetItemId(phdr, i)->lp_off <= offset)
> + PageGetItemId(phdr, i)->lp_off += size;
> }
> }
> }

>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
> message can get through to the mailing list cleanly

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Browse pgsql-patches by date

  From Date Subject
Next Message Mark Halliwell 2003-01-09 02:30:14 Recent MemSet change to DirectFunctionCall1
Previous Message Bruce Momjian 2003-01-09 01:16:12 Re: Typos