ossp-pkg/cfg/cfg_buf.c 1.1 -> 1.2
--- cfg_buf.c 2002/07/04 12:18:47 1.1
+++ cfg_buf.c 2002/07/04 14:51:21 1.2
@@ -86,11 +86,20 @@
cfg_rc_t cfg_buf_format(cfg_buf_t *buf, const char *fmt, ...)
{
- cfg_rc_t rc;
va_list ap;
- int n;
+ cfg_rc_t rc;
va_start(ap, fmt);
+ rc = cfg_buf_vformat(buf, fmt, ap);
+ va_end(ap);
+ return rc;
+}
+
+cfg_rc_t cfg_buf_vformat(cfg_buf_t *buf, const char *fmt, va_list ap)
+{
+ cfg_rc_t rc;
+ int n;
+
if (buf == NULL || fmt == NULL)
return CFG_ERR_ARG;
if ((n = cfg_fmt_vsprintf(NULL, -1, fmt, ap)) == -1)
@@ -102,7 +111,6 @@
fmt, ap)) == -1)
return CFG_ERR_FMT;
buf->buf_len += n;
- va_end(ap);
return CFG_OK;
}
|
|