Small stylistic change

Поиск
Список
Период
Сортировка
От Manfred Koizar
Тема Small stylistic change
Дата
Msg-id hnal1vshse46f0t6vhsnago0jh0htgjdgd@4ax.com
обсуждение исходный текст
Ответы Re: Small stylistic change  (Bruce Momjian <pgman@candle.pha.pa.us>)
Re: Small stylistic change  (Bruce Momjian <pgman@candle.pha.pa.us>)
Список pgsql-patches
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;
         }
     }
 }

В списке pgsql-patches по дате отправления:

Предыдущее
От: Manfred Koizar
Дата:
Сообщение: Typos
Следующее
От: Jon Jensen
Дата:
Сообщение: Re: Refuse SSL patch