From: Martin Mares Date: Wed, 16 Nov 2005 13:09:32 +0000 (+0000) Subject: Added cfg_printf(), which will be useful for formatting of error messages X-Git-Tag: holmes-import~708 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=6ef7d05283f9005e379e63a6f58c22302b8136a7;p=libucw.git Added cfg_printf(), which will be useful for formatting of error messages used in configuration parsers. --- diff --git a/lib/conf.c b/lib/conf.c index 2293cdae..7f593d8e 100644 --- a/lib/conf.c +++ b/lib/conf.c @@ -58,6 +58,16 @@ 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) diff --git a/lib/conf.h b/lib/conf.h index 85a9ebe5..ef727512 100644 --- a/lib/conf.h +++ b/lib/conf.h @@ -21,6 +21,7 @@ extern struct mempool *cfpool; void *cfg_malloc(uns size); void *cfg_malloc_zero(uns size); byte *cfg_strdup(byte *s); +byte *cfg_printf(char *fmt, ...) FORMAT_CHECK(printf,1,2); /* * Every module places its configuration setting into some section. Section is