Revert "Fix str_format on mingw"

This reverts commit a9f6d3716c.
This commit is contained in:
heinrich5991 2020-06-29 13:48:51 +02:00
parent 186f917cc9
commit 741c3a705e

View file

@ -2333,13 +2333,11 @@ int str_length(const char *str)
int str_format(char *buffer, int buffer_size, const char *format, ...) int str_format(char *buffer, int buffer_size, const char *format, ...)
{ {
int ret; int ret;
#if defined(CONF_FAMILY_WINDOWS)
va_list ap; va_list ap;
va_start(ap, format); va_start(ap, format);
#if defined(__MINGW32__)
ret = __mingw_vsnprintf(buffer, buffer_size, format, ap);
#elif defined(CONF_FAMILY_WINDOWS)
ret = _vsnprintf(buffer, buffer_size, format, ap); ret = _vsnprintf(buffer, buffer_size, format, ap);
va_end(ap);
buffer[buffer_size-1] = 0; /* assure null termination */ buffer[buffer_size-1] = 0; /* assure null termination */
@ -2348,11 +2346,13 @@ int str_format(char *buffer, int buffer_size, const char *format, ...)
if(ret < 0) if(ret < 0)
ret = buffer_size - 1; ret = buffer_size - 1;
#else #else
va_list ap;
va_start(ap, format);
ret = vsnprintf(buffer, buffer_size, format, ap); ret = vsnprintf(buffer, buffer_size, format, ap);
#endif
va_end(ap); va_end(ap);
/* null termination is assured by definition of vsnprintf */ /* null termination is assured by definition of vsnprintf */
#endif
/* a return value of buffer_size or more indicates truncated output */ /* a return value of buffer_size or more indicates truncated output */
if(ret >= buffer_size) if(ret >= buffer_size)