]> mj.ucw.cz Git - libucw.git/commitdiff
Added cfg_printf(), which will be useful for formatting of error messages
authorMartin Mares <mj@ucw.cz>
Wed, 16 Nov 2005 13:09:32 +0000 (13:09 +0000)
committerMartin Mares <mj@ucw.cz>
Wed, 16 Nov 2005 13:09:32 +0000 (13:09 +0000)
used in configuration parsers.

lib/conf.c
lib/conf.h

index 2293cdae84a836ab7b22e0d6504e2003c80d228f..7f593d8e419d68f6c46288f439a083db7f73d216 100644 (file)
@@ -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)
index 85a9ebe564fad3b09d2c98cfae3c110af366cd9a..ef727512b2b08f1d97706dd3ad9614f9434d2843 100644 (file)
@@ -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