Tue, 16 Jan 2024 23:16:15 +0100
fix unnecessary printf retry when printed string is empty
src/printf.c | file | annotate | diff | comparison | revisions |
--- a/src/printf.c Tue Jan 16 23:15:36 2024 +0100 +++ b/src/printf.c Tue Jan 16 23:16:15 2024 +0100 @@ -108,7 +108,7 @@ va_list ap2; va_copy(ap2, ap); int ret = vsnprintf(buf, CX_PRINTF_SBO_SIZE, fmt, ap); - if (ret > 0 && ret < CX_PRINTF_SBO_SIZE) { + if (ret >= 0 && ret < CX_PRINTF_SBO_SIZE) { s.ptr = cxMalloc(a, ret + 1); if (s.ptr) { s.length = (size_t) ret;