X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=ucw%2Fconf-alloc.c;h=f5f80cc8067f19a9db967396a362e5cef5e81d3a;hb=fd2a1b7dd39127af9f4deaaea56ce3deb5102585;hp=1a0de4f22d1ed5fa39795d1bc2ab53a8761fee14;hpb=1cf8ac51f5495ccd5187dc220ffc69e95d6e0cfc;p=libucw.git diff --git a/ucw/conf-alloc.c b/ucw/conf-alloc.c index 1a0de4f2..f5f80cc8 100644 --- a/ucw/conf-alloc.c +++ b/ucw/conf-alloc.c @@ -2,34 +2,39 @@ * UCW Library -- Configuration files: memory allocation * * (c) 2001--2006 Robert Spalek - * (c) 2003--2006 Martin Mares + * (c) 2003--2012 Martin Mares * * This software may be freely distributed and used according to the terms * of the GNU Lesser General Public License. */ -#include "ucw/lib.h" -#include "ucw/conf.h" -#include "ucw/mempool.h" +#include +#include +#include +#include -struct mempool *cf_pool; // current pool for loading new configuration +inline struct mempool * +cf_get_pool(void) +{ + return cf_get_context()->pool; +} void * cf_malloc(uns size) { - return mp_alloc(cf_pool, size); + return mp_alloc(cf_get_pool(), size); } void * cf_malloc_zero(uns size) { - return mp_alloc_zero(cf_pool, size); + return mp_alloc_zero(cf_get_pool(), size); } char * cf_strdup(const char *s) { - return mp_strdup(cf_pool, s); + return mp_strdup(cf_get_pool(), s); } char * @@ -37,7 +42,7 @@ cf_printf(const char *fmt, ...) { va_list args; va_start(args, fmt); - char *res = mp_vprintf(cf_pool, fmt, args); + char *res = mp_vprintf(cf_get_pool(), fmt, args); va_end(args); return res; }