mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2024-11-17 16:48:43 +00:00
Resources: added mb_move() to complement rmove() for memory blocks
This commit is contained in:
parent
4635314cef
commit
a9938b1792
@ -393,6 +393,21 @@ mb_realloc(void *m, unsigned size)
|
||||
return b->data;
|
||||
}
|
||||
|
||||
/**
|
||||
* mb_move - move a memory block
|
||||
* @m: memory block
|
||||
* @p: target pool
|
||||
*
|
||||
* mb_move() moves the given memory block to another pool in the same way
|
||||
* as rmove() moves a plain resource.
|
||||
*/
|
||||
void
|
||||
mb_move(void *m, pool *p)
|
||||
{
|
||||
struct mblock *b = SKIP_BACK(struct mblock, data, m);
|
||||
rmove(b, p);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* mb_free - free a memory block
|
||||
|
@ -53,6 +53,7 @@ extern pool root_pool;
|
||||
void *mb_alloc(pool *, unsigned size);
|
||||
void *mb_allocz(pool *, unsigned size);
|
||||
void *mb_realloc(void *m, unsigned size);
|
||||
void mb_move(void *, pool *);
|
||||
void mb_free(void *);
|
||||
|
||||
/* Memory pools with linear allocation */
|
||||
|
Loading…
Reference in New Issue
Block a user