]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Simplify handling of free chunks.
authorMartin Mares <mj@ucw.cz>
Fri, 29 Oct 1999 10:08:27 +0000 (10:08 +0000)
committerMartin Mares <mj@ucw.cz>
Fri, 29 Oct 1999 10:08:27 +0000 (10:08 +0000)
lib/mempool.c

index b2c8862cb5a29965c3f384537f2fead53b38189f..faf0334abc357a3f17f6165f943d910a6b9dc63e 100644 (file)
@@ -73,9 +73,12 @@ lp_alloc(linpool *m, unsigned size)
        }
       else
        {
-         if (m->current && m->current->next)
-           /* Still have free chunks from previous incarnation (before lp_flush()) */
-           c = m->current->next;
+         if (m->current)
+           {
+             /* Still have free chunks from previous incarnation (before lp_flush()) */
+             c = m->current;
+             m->current = c->next;
+           }
          else
            {
              /* Need to allocate a new chunk */
@@ -85,7 +88,6 @@ lp_alloc(linpool *m, unsigned size)
              m->plast = &c->next;
              c->next = NULL;
            }
-         m->current = c;
          m->ptr = c->data + size;
          m->end = c->data + m->chunk_size;
        }