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);
27 buf = MALLOC(buf_size);
30 void *p = REALLOC(buf, buf_size);
39 cb_ret = cb(buf, wrote, key);
40 if(buf != scratch) FREEMEM(buf);