diff options
Diffstat (limited to 'lib/vasprintf.c')
-rw-r--r-- | lib/vasprintf.c | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/lib/vasprintf.c b/lib/vasprintf.c index dcc3061966..24e30d8731 100644 --- a/lib/vasprintf.c +++ b/lib/vasprintf.c @@ -9,24 +9,23 @@ int _gnutls_vasprintf(char **strp, const char *fmt, va_list ap) { -char * buf; -int ret, max; + char *buf; + int ret, max; - max = MAX_BSIZE/2; + max = MAX_BSIZE / 2; - do - { - max *= 2; + do { + max *= 2; - buf = malloc(max); - if (buf == NULL) - return -1; - - ret = vsnprintf(buf, max, fmt, ap); - } - while (ret > max && max < NO_MORE_MAX); + buf = malloc(max); + if (buf == NULL) + return -1; - return ret; + ret = vsnprintf(buf, max, fmt, ap); + } + while (ret > max && max < NO_MORE_MAX); + + return ret; } #endif |