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