From: Andre Noll Date: Tue, 6 Jan 2015 16:12:33 +0000 (+0100) Subject: str.c: Remove vsnprintf() workaround for old glibc. X-Git-Tag: v0.1.6~6 X-Git-Url: http://git.tuebingen.mpg.de/?p=dss.git;a=commitdiff_plain;h=75958eeeb542bea34efe72c61501227036ea9626 str.c: Remove vsnprintf() workaround for old glibc. Since glibc-2.1 was released 16 years ago, the workaround for glibc-2.0 is no longer necessary. Even the example code of printf(3) dropped it. --- diff --git a/str.c b/str.c index 557eaa3..cca898d 100644 --- a/str.c +++ b/str.c @@ -147,16 +147,12 @@ __must_check __printf_1_2 __malloc char *make_message(const char *fmt, ...) n = vsnprintf(msg, size, fmt, ap); va_end(ap); /* If that worked, return the string. */ - if (n > -1 && n < size) - break; + if (n < size) + return msg; /* Else try again with more space. */ - if (n > -1) /* glibc 2.1 */ - size = n + 1; /* precisely what is needed */ - else /* glibc 2.0 */ - size *= 2; /* twice the old size */ + size = n + 1; /* precisely what is needed */ msg = dss_realloc(msg, size); } - return msg; } /**