X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=lib%2Fconf.c;h=7f593d8e419d68f6c46288f439a083db7f73d216;hb=6829bc0163f6ecfc8ae70ee7b3ce2b79e7484dfe;hp=28bbeaff954d2aa47c26f17ff2f0a8a324bf0661;hpb=2237687dce28209d9b1dd8ef23b9a915c80b390c;p=libucw.git diff --git a/lib/conf.c b/lib/conf.c index 28bbeaff..7f593d8e 100644 --- a/lib/conf.c +++ b/lib/conf.c @@ -1,8 +1,8 @@ /* - * Sherlock Library -- Reading of configuration files + * UCW Library -- Reading of configuration files * * (c) 2001 Robert Spalek - * (c) 2003 Martin Mares + * (c) 2003--2005 Martin Mares * * This software may be freely distributed and used according to the terms * of the GNU Lesser General Public License. @@ -28,6 +28,10 @@ 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)