From e223cec9c20dc4cdf5e5d6c69d65bced1a2ff7ff Mon Sep 17 00:00:00 2001 From: Kawe Mazidjatari <48657826+Mauler125@users.noreply.github.com> Date: Sun, 9 Feb 2025 00:52:32 +0100 Subject: [PATCH] Engine: don't grow the string buffer Just switch the format string instead, avoids reallocs. --- src/engine/net.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/engine/net.cpp b/src/engine/net.cpp index 3d1ba10a..e52f3a28 100644 --- a/src/engine/net.cpp +++ b/src/engine/net.cpp @@ -247,12 +247,7 @@ void NET_PrintFunc(const char* fmt, ...) result = FormatV(fmt, args); va_end(args); - if (result.back() != '\n') - { - result.push_back('\n'); - } - - Msg(context, "%s", result.c_str()); + Msg(context, result.back() == '\n' ? "%s" : "%s\n", result.c_str()); } //-----------------------------------------------------------------------------