mirror of
https://gitlab.labs.nic.cz/labs/bird.git
synced 2024-05-11 16:54:54 +00:00
Simplify handling of free chunks.
This commit is contained in:
@@ -73,9 +73,12 @@ lp_alloc(linpool *m, unsigned size)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (m->current && m->current->next)
|
if (m->current)
|
||||||
/* Still have free chunks from previous incarnation (before lp_flush()) */
|
{
|
||||||
c = m->current->next;
|
/* Still have free chunks from previous incarnation (before lp_flush()) */
|
||||||
|
c = m->current;
|
||||||
|
m->current = c->next;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Need to allocate a new chunk */
|
/* Need to allocate a new chunk */
|
||||||
@@ -85,7 +88,6 @@ lp_alloc(linpool *m, unsigned size)
|
|||||||
m->plast = &c->next;
|
m->plast = &c->next;
|
||||||
c->next = NULL;
|
c->next = NULL;
|
||||||
}
|
}
|
||||||
m->current = c;
|
|
||||||
m->ptr = c->data + size;
|
m->ptr = c->data + size;
|
||||||
m->end = c->data + m->chunk_size;
|
m->end = c->data + m->chunk_size;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user