0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-11-08 12:18:42 +00:00

Resource pools are now named.

This commit is contained in:
Martin Mares 1998-05-26 21:37:37 +00:00
parent d5417b379f
commit ed68a5c6a4
3 changed files with 6 additions and 4 deletions

View File

@ -15,6 +15,7 @@
struct pool { struct pool {
resource r; resource r;
list inside; list inside;
char *name;
}; };
static void pool_dump(resource *); static void pool_dump(resource *);
@ -32,7 +33,7 @@ pool root_pool;
static int indent; static int indent;
pool * pool *
rp_new(pool *p) rp_new(pool *p, char *name)
{ {
pool *z = ralloc(p, &pool_class); pool *z = ralloc(p, &pool_class);
init_list(&z->inside); init_list(&z->inside);
@ -60,7 +61,7 @@ pool_dump(resource *P)
pool *p = (pool *) P; pool *p = (pool *) P;
resource *r; resource *r;
debug("\n"); debug(" %s\n", p->name);
indent += 3; indent += 3;
WALK_LIST(r, p->inside) WALK_LIST(r, p->inside)
rdump(r); rdump(r);
@ -112,6 +113,7 @@ void
resource_init(void) resource_init(void)
{ {
root_pool.r.class = &pool_class; root_pool.r.class = &pool_class;
root_pool.name = "Root";
init_list(&root_pool.inside); init_list(&root_pool.inside);
} }

View File

@ -32,7 +32,7 @@ struct resclass {
typedef struct pool pool; typedef struct pool pool;
void resource_init(void); void resource_init(void);
pool *rp_new(pool *); /* Create new pool */ pool *rp_new(pool *, char *); /* Create new pool */
void rp_free(pool *); /* Free everything in the pool */ void rp_free(pool *); /* Free everything in the pool */
void rfree(void *); /* Free single resource */ void rfree(void *); /* Free single resource */
void rdump(void *); /* Dump to debug output */ void rdump(void *); /* Dump to debug output */

View File

@ -138,6 +138,6 @@ rta_dump_all(void)
void void
rta_init(void) rta_init(void)
{ {
rta_pool = rp_new(&root_pool); rta_pool = rp_new(&root_pool, "Attributes");
rta_slab = sl_new(rta_pool, sizeof(rta)); rta_slab = sl_new(rta_pool, sizeof(rta));
} }