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