]> mj.ucw.cz Git - libucw.git/blobdiff - lib/conf.c
Added bit_array_assign(), replaced BIT_ARRAY_ALLOC by functions.
[libucw.git] / lib / conf.c
index b29b768285fb8add587f7443ee155a78180e748c..7f593d8e419d68f6c46288f439a083db7f73d216 100644 (file)
@@ -1,8 +1,8 @@
 /*
- *     Sherlock Library -- Reading of configuration files
+ *     UCW Library -- Reading of configuration files
  *
  *     (c) 2001 Robert Spalek <robert@ucw.cz>
- *     (c) 2003 Martin Mares <mj@ucw.cz>
+ *     (c) 2003--2005 Martin Mares <mj@ucw.cz>
  *
  *     This software may be freely distributed and used according to the terms
  *     of the GNU Lesser General Public License.
@@ -11,7 +11,7 @@
 #include "lib/lib.h"
 #include "lib/chartype.h"
 #include "lib/fastbuf.h"
-#include "lib/pools.h"
+#include "lib/mempool.h"
 
 #include "lib/conf.h"
 
 static struct cfitem *cfsection;
 struct mempool *cfpool;
 
+#ifndef DEFAULT_CONFIG
+#define DEFAULT_CONFIG NULL
+#endif
+
 byte *cfdeffile = DEFAULT_CONFIG;
 
 static void CONSTRUCTOR
@@ -42,12 +46,28 @@ cfg_malloc(uns size)
        return mp_alloc(cfpool, size);
 }
 
+void *
+cfg_malloc_zero(uns size)
+{
+       return mp_alloc_zero(cfpool, size);
+}
+
 byte *
 cfg_strdup(byte *s)
 {
        return mp_strdup(cfpool, s);
 }
 
+byte *
+cfg_printf(char *fmt, ...)
+{
+       va_list args;
+       va_start(args, fmt);
+       byte *res = mp_vprintf(cfpool, fmt, args);
+       va_end(args);
+       return res;
+}
+
 void cf_register(struct cfitem *items)
 {
        if(items[0].type!=CT_SECTION && items[0].type!=CT_INCOMPLETE_SECTION)