summaryrefslogtreecommitdiffstats
path: root/lib/mempool.c
diff options
context:
space:
mode:
authorMartin Mares <mj@ucw.cz>1999-10-29 12:08:27 +0200
committerMartin Mares <mj@ucw.cz>1999-10-29 12:08:27 +0200
commit92af6f309b9283482384bd9bbd0351cd71e3cf1d (patch)
treef3acfea21bf6fd324c1278e2ad58a5dff2a8adbc /lib/mempool.c
parent54165b1315dd09b0ea97705367b73086131c1ed8 (diff)
downloadbird-92af6f309b9283482384bd9bbd0351cd71e3cf1d.tar
bird-92af6f309b9283482384bd9bbd0351cd71e3cf1d.zip
Simplify handling of free chunks.
Diffstat (limited to 'lib/mempool.c')
-rw-r--r--lib/mempool.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/mempool.c b/lib/mempool.c
index b2c8862..faf0334 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;
}