From: Martin Mares Date: Fri, 29 Oct 1999 10:08:27 +0000 (+0000) Subject: Simplify handling of free chunks. X-Git-Tag: v1.2.0~1487 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=92af6f309b9283482384bd9bbd0351cd71e3cf1d;p=thirdparty%2Fbird.git Simplify handling of free chunks. --- diff --git a/lib/mempool.c b/lib/mempool.c index b2c8862cb..faf0334ab 100644 --- a/lib/mempool.c +++ b/lib/mempool.c @@ -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; }