| #include "../git-compat-util.h" |
| * The size parameter specifies the available space, i.e. includes |
| * the trailing NUL byte; but Windows's vsnprintf expects the |
| * number of characters to write without the trailing NUL. |
| #ifndef SNPRINTF_SIZE_CORR |
| #if defined(__MINGW32__) && defined(__GNUC__) && __GNUC__ < 4 |
| #define SNPRINTF_SIZE_CORR 1 |
| #define SNPRINTF_SIZE_CORR 0 |
| int git_vsnprintf(char *str, size_t maxsize, const char *format, va_list ap) |
| ret = vsnprintf(str, maxsize-SNPRINTF_SIZE_CORR, format, ap); |
| /* Windows does not NUL-terminate if result fills buffer */ |
| str = realloc(s, maxsize); |
| ret = vsnprintf(str, maxsize-SNPRINTF_SIZE_CORR, format, ap); |
| int git_snprintf(char *str, size_t maxsize, const char *format, ...) |
| ret = git_vsnprintf(str, maxsize, format, ap); |