11 static StrFormatResult
12 buffer_str(
void *user_data,
const char *data,
unsigned int len)
14 struct FmtBuffer *buffer = (
struct FmtBuffer*)user_data;
15 if (len >= buffer->left) {
20 memcpy(buffer->pos, data, len);
26 int snprintf(
char *str,
size_t size,
const char *format, ...)
31 res = vsnprintf(str, size, format, ap);
36 int vsnprintf(
char *str,
size_t size,
const char *format, va_list ap)
38 struct FmtBuffer buffer;
39 StrFormatContext ctxt;
41 ctxt.write_str = buffer_str;
42 ctxt.user_data = &buffer;
45 res = format_str_v(&ctxt, format, ap);