mirror of
https://gitlab.labs.nic.cz/labs/bird.git
synced 2024-05-11 16:54:54 +00:00
Changes OSPF to generate stub networks for non-primary addresses.
Also does some reorganization in RT LSA announcement.
This commit is contained in:
@@ -327,6 +327,42 @@ mb_allocz(pool *p, unsigned size)
|
||||
return x;
|
||||
}
|
||||
|
||||
/**
|
||||
* mb_realloc - reallocate a memory block
|
||||
* @p: pool
|
||||
* @m: memory block
|
||||
* @size: new size of the block
|
||||
*
|
||||
* mb_realloc() changes the size of the memory block @m to a given size.
|
||||
* The contents will be unchanged to the minimum of the old and new sizes;
|
||||
* newly allocated memory will be uninitialized. If @m is NULL, the call
|
||||
* is equivalent to mb_alloc(@p, @size).
|
||||
*
|
||||
* Like mb_alloc(), mb_realloc() also returns a pointer to the memory
|
||||
* chunk , not to the resource, hence you have to free it using
|
||||
* mb_free(), not rfree().
|
||||
*/
|
||||
void *
|
||||
mb_realloc(pool *p, void *m, unsigned size)
|
||||
{
|
||||
struct mblock *ob = NULL;
|
||||
|
||||
if (m)
|
||||
{
|
||||
ob = SKIP_BACK(struct mblock, data, m);
|
||||
if (ob->r.n.next)
|
||||
rem_node(&ob->r.n);
|
||||
}
|
||||
|
||||
struct mblock *b = xrealloc(ob, sizeof(struct mblock) + size);
|
||||
|
||||
b->r.class = &mb_class;
|
||||
add_tail(&p->inside, &b->r.n);
|
||||
b->size = size;
|
||||
return b->data;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* mb_free - free a memory block
|
||||
* @m: memory block
|
||||
@@ -339,3 +375,4 @@ mb_free(void *m)
|
||||
struct mblock *b = SKIP_BACK(struct mblock, data, m);
|
||||
rfree(b);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user