diff options
Diffstat (limited to 'contrib/binutils/libiberty/vasprintf.c')
-rw-r--r-- | contrib/binutils/libiberty/vasprintf.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/contrib/binutils/libiberty/vasprintf.c b/contrib/binutils/libiberty/vasprintf.c index 3794cbd..da83db2 100644 --- a/contrib/binutils/libiberty/vasprintf.c +++ b/contrib/binutils/libiberty/vasprintf.c @@ -74,7 +74,7 @@ int_vasprintf (result, format, args) } while (strchr ("hlL", *p)) ++p; - /* Should be big enough for any format specifier except %s. */ + /* Should be big enough for any format specifier except %s and floats. */ total_width += 30; switch (*p) { @@ -93,6 +93,9 @@ int_vasprintf (result, format, args) case 'g': case 'G': (void) va_arg (ap, double); + /* Since an ieee double can have an exponent of 307, we'll + make the buffer wide enough to cover the gross case. */ + total_width += 307; break; case 's': total_width += strlen (va_arg (ap, char *)); @@ -118,7 +121,11 @@ int vasprintf (result, format, args) char **result; const char *format; +#if defined (_BSD_VA_LIST_) && defined (__FreeBSD__) + _BSD_VA_LIST_ args; +#else va_list args; +#endif { return int_vasprintf (result, format, &args); } |