1 #include <asn_internal.h>
4 asn__format_to_callback(int (*cb)(const void *, size_t, void *key), void *key,
5 const char *fmt, ...) {
8 size_t buf_size = sizeof(scratch);
16 wrote = vsnprintf(buf, buf_size, fmt, args);
17 if(wrote < (ssize_t)buf_size) {
19 if(buf != scratch) FREEMEM(buf);
28 buf = MALLOC(buf_size);
31 void *p = REALLOC(buf, buf_size);
40 cb_ret = cb(buf, wrote, key);
41 if(buf != scratch) FREEMEM(buf);