]> mj.ucw.cz Git - libucw.git/blob - lib/conf-alloc.c
Merge with git+ssh://git.ucw.cz/projects/sherlock/GIT/sherlock.git
[libucw.git] / lib / conf-alloc.c
1 /*
2  *      UCW Library -- Configuration files: memory allocation
3  *
4  *      (c) 2001--2006 Robert Spalek <robert@ucw.cz>
5  *      (c) 2003--2006 Martin Mares <mj@ucw.cz>
6  *
7  *      This software may be freely distributed and used according to the terms
8  *      of the GNU Lesser General Public License.
9  */
10
11 #include "lib/lib.h"
12 #include "lib/conf.h"
13 #include "lib/mempool.h"
14
15 struct mempool *cf_pool;        // current pool for loading new configuration
16
17 void *
18 cf_malloc(uns size)
19 {
20   return mp_alloc(cf_pool, size);
21 }
22
23 void *
24 cf_malloc_zero(uns size)
25 {
26   return mp_alloc_zero(cf_pool, size);
27 }
28
29 byte *
30 cf_strdup(byte *s)
31 {
32   return mp_strdup(cf_pool, s);
33 }
34
35 byte *
36 cf_printf(char *fmt, ...)
37 {
38   va_list args;
39   va_start(args, fmt);
40   byte *res = mp_vprintf(cf_pool, fmt, args);
41   va_end(args);
42   return res;
43 }