From e49ef525e792f636edb50512675114b307dad694 Mon Sep 17 00:00:00 2001 From: TD-er Date: Tue, 28 Jan 2025 15:12:29 +0100 Subject: [PATCH] [Memory] Add small optimization in free_string() to prevent copying --- src/src/Helpers/StringConverter.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/src/Helpers/StringConverter.cpp b/src/src/Helpers/StringConverter.cpp index eb4415a6bf..091bb87dc4 100644 --- a/src/src/Helpers/StringConverter.cpp +++ b/src/src/Helpers/StringConverter.cpp @@ -109,7 +109,8 @@ bool reserve_special(String& str, size_t size) { void free_string(String& str) { // This is a call specifically tailored to what is done in: // void String::move(String &rhs) - + + str.clear(); // Prevent any unneeded copying String tmp(std::move(str)); }