--- libaitio/inc/aitio.h 2012/08/29 13:51:29 1.25 +++ libaitio/inc/aitio.h 2012/09/03 12:18:27 1.25.2.2 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: aitio.h,v 1.25 2012/08/29 13:51:29 misho Exp $ +* $Id: aitio.h,v 1.25.2.2 2012/09/03 12:18:27 misho Exp $ * ************************************************************************** The ELWIX and AITNET software is distributed under the following @@ -245,6 +245,8 @@ typedef struct { void *__p = io_realloc(__val->val.string, AIT_LEN(__val) + __l); \ if (__p) { \ AIT_LEN(__val) += __l; \ + if (!__val->val.string) \ + memset(__p, 0, AIT_LEN(__val)); \ __val->val.string = __p; \ strlcat((char*) __val->val.string, __s, \ AIT_LEN(__val)); \ @@ -546,6 +548,15 @@ inline void io_freeVar(ait_val_t ** __restrict val); * return: NULL error or new variable, after use free variable with io_freeVar() */ ait_val_t *io_makeVar(ait_type_t type, ...); +/* + * io_sprintfVar() - Builtin string variable from formatted input + * + * @v = variable + * @fmt = format string + * @... = argument(s) + * return: -1 error or >0 copied bytes to variable + */ +int io_sprintfVar(ait_val_t * __restrict v, const char *fmt, ...); /* * io_hashVar() - Generate hash key for variable from string or value *