Skip to content

Commit e49ef52

Browse files
committed
[Memory] Add small optimization in free_string() to prevent copying
1 parent 21fbe83 commit e49ef52

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/src/Helpers/StringConverter.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,8 @@ bool reserve_special(String& str, size_t size) {
109109
void free_string(String& str) {
110110
// This is a call specifically tailored to what is done in:
111111
// void String::move(String &rhs)
112-
112+
113+
str.clear(); // Prevent any unneeded copying
113114
String tmp(std::move(str));
114115
}
115116

0 commit comments

Comments
 (0)