8 #define vsnprintf _vsnprintf
11 int obstack_vprintf(struct obstack *obst, const char *fmt, va_list ap)
15 size_t size = sizeof(buf);
21 len = vsnprintf(buffer, size, fmt, tap);
23 /* snprintf should return -1 only in the error case, but older glibcs
24 * and probably other systems are buggy in this respect and return -1 if
25 * the buffer was too small. We only abort for LARGE unrealistic buffer
33 } else if ((size_t)len >= size) {
34 /* If we come here more than once, vsnprintf() returned garbage */
35 assert(buffer == buf);
36 size = (size_t)len + 1;
40 buffer = malloc(size);
43 obstack_grow(obst, buffer, len);
50 int obstack_printf(struct obstack *obst, const char *fmt, ...)
56 res = obstack_vprintf(obst, fmt, ap);