8 /* win32/C89 has no va_copy function... so we have to use the stupid fixed-length version */
9 int obstack_vprintf(struct obstack *obst, const char *fmt, va_list ap) FIRM_NOTHROW
12 int len = _vsnprintf(buf, sizeof(buf), fmt, ap);
13 obstack_grow(obst, buf, len);
17 int obstack_vprintf(struct obstack *obst, const char *fmt, va_list ap) FIRM_NOTHROW
21 size_t size = sizeof(buf);
27 len = vsnprintf(buffer, size, fmt, tap);
29 /* snprintf should return -1 only in the error case, but older glibcs
30 * and probably other systems are buggy in this respect and return -1 if
31 * the buffer was too small. We only abort for LARGE unrealistic buffer
39 } else if ((size_t)len >= size) {
40 /* If we come here more than once, vsnprintf() returned garbage */
41 assert(buffer == buf);
42 size = (size_t)len + 1;
46 buffer = (char*)malloc(size);
49 obstack_grow(obst, buffer, len);
57 int obstack_printf(struct obstack *obst, const char *fmt, ...) FIRM_NOTHROW
63 res = obstack_vprintf(obst, fmt, ap);