Skip to content

Commit

Permalink
[Memory] Add small optimization in free_string() to prevent copying
Browse files Browse the repository at this point in the history
  • Loading branch information
TD-er committed Jan 28, 2025
1 parent 21fbe83 commit e49ef52
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/src/Helpers/StringConverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

Expand Down

0 comments on commit e49ef52

Please sign in to comment.