]> mj.ucw.cz Git - libucw.git/blobdiff - ucw/conf-alloc.c
Opt: Added OPT_HELP_COLUMNS
[libucw.git] / ucw / conf-alloc.c
index 937965dd19f3d86dd7213c87a53042958a397e6f..bf4569e1614d7cdacbd377119b155d123b4f25e2 100644 (file)
@@ -2,7 +2,7 @@
  *     UCW Library -- Configuration files: memory allocation
  *
  *     (c) 2001--2006 Robert Spalek <robert@ucw.cz>
- *     (c) 2003--2006 Martin Mares <mj@ucw.cz>
+ *     (c) 2003--2012 Martin Mares <mj@ucw.cz>
  *
  *     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/conf-internal.h>
 #include <ucw/mempool.h>
 
-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)
+cf_malloc(uint size)
 {
-  return mp_alloc(cf_pool, size);
+  return mp_alloc(cf_get_pool(), size);
 }
 
 void *
-cf_malloc_zero(uns size)
+cf_malloc_zero(uint 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;
 }