X-Git-Url: http://git.tuebingen.mpg.de/?p=dss.git;a=blobdiff_plain;f=str.c;h=623def1fd9b7aa7ee72f221aa6759fcf74b70948;hp=557eaa38ca6352dab2c435ae619ef0fc60700047;hb=c806f5edbbd5383c807b18ad5157b189c90fd6c7;hpb=bc13db9debf825347d397c292e075cbe3f804ac0 diff --git a/str.c b/str.c index 557eaa3..623def1 100644 --- a/str.c +++ b/str.c @@ -1,8 +1,4 @@ -/* - * Copyright (C) 2004-2010 Andre Noll - * - * Licensed under the GPL v2. For licencing details see COPYING. - */ +/* SPDX-License-Identifier: GPL-2.0 */ #include #include #include @@ -147,16 +143,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; } /**