diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/resource.c | 4 | ||||
-rw-r--r-- | lib/resource.h | 7 |
2 files changed, 9 insertions, 2 deletions
diff --git a/lib/resource.c b/lib/resource.c index 94b8d019..0006bc8d 100644 --- a/lib/resource.c +++ b/lib/resource.c @@ -298,7 +298,7 @@ void tmp_flush(void) { lp_flush(tmp_linpool); - rfree(tmp_res.pool); + rp_free(tmp_res.pool); tmp_res.pool = rp_new(tmp_res.parent, "TMP"); } @@ -449,7 +449,7 @@ mb_free(void *m) return; struct mblock *b = SKIP_BACK(struct mblock, data, m); - rfree(b); + rfree(&b->r); } diff --git a/lib/resource.h b/lib/resource.h index 911b990d..64803778 100644 --- a/lib/resource.h +++ b/lib/resource.h @@ -58,6 +58,12 @@ void rmove(void *, pool *); /* Move to a different pool */ void *ralloc(pool *, struct resclass *); +pool *rp_new(pool *, const char *); /* Create a new pool */ +pool *rp_newf(pool *, const char *, ...); /* Create a new pool with a formatted string as its name */ +void rp_init(pool *, const char *); /* Init a new pool */ +void rp_initf(pool *, const char *, ...); /* Init a new pool with a formatted string as its name */ +static inline void rp_free(pool *p) { rfree(&p->r); } /* Free the whole pool */ + extern pool root_pool; /* Normal memory blocks */ @@ -111,6 +117,7 @@ slab *sl_new(pool *, unsigned size); void *sl_alloc(slab *); void *sl_allocz(slab *); void sl_free(void *); +void sl_delete(slab *); /* * Low-level memory allocation functions, please don't use |