From e07b63185691f3f7ccfd36f80b23200efe00e818 Mon Sep 17 00:00:00 2001 From: Brett Date: Wed, 8 Feb 2023 13:16:31 -0500 Subject: [PATCH] Switch to vector --- src/blt/std/logging.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/blt/std/logging.cpp b/src/blt/std/logging.cpp index ef30261..c04a17f 100644 --- a/src/blt/std/logging.cpp +++ b/src/blt/std/logging.cpp @@ -61,10 +61,9 @@ namespace blt::logging { }; void applyFormatting(const std::string& format, std::string& output, va_list& args){ - const char* fmt_c_str = format.c_str(); - char formattedChars[1+std::vsnprintf(nullptr, 0, fmt_c_str, args)]; - vsprintf(formattedChars, fmt_c_str, args); - output = std::string(formattedChars); + std::vector buf(1+std::vsnprintf(nullptr, 0, format.c_str(), args)); + vsprintf(buf.data(), format.c_str(), args); + output = std::string(buf.data()); } const char* levelColors[6] = {