musl-obstack/obstack_printf.c

19 lines
330 B
C
Raw Permalink Normal View History

2017-01-14 00:23:18 +00:00
#include <stdarg.h>
#include <stdio.h>
#include <strings.h>
#include "obstack.h"
int obstack_printf(struct obstack *obstack, const char *__restrict fmt, ...)
{
char buf[1024];
va_list ap;
int len;
va_start(ap, fmt);
len = vsnprintf(buf, sizeof(buf), fmt, ap);
obstack_grow(obstack, buf, len);
va_end(ap);
return len;
}