[gdb/cli] Skip string copy in source_cache::ensure
In function source_cache::ensure we have: ... std::ostringstream output; ... contents = output.str (); ... The last line causes an unnecessary string copy. C++20 allows us to skip it, like this: ... contents = std::move (output).str (); ... Use the more efficient solution. Tested on x86_64-linux. Reviewed-By: Lancelot Six <lancelot.six@amd.com>
This commit is contained in:
parent
3233ad1e4e
commit
7e56491567
1 changed files with 1 additions and 1 deletions
|
@ -252,7 +252,7 @@ source_cache::ensure (struct symtab *s)
|
|||
std::istringstream input (contents);
|
||||
std::ostringstream output;
|
||||
highlighter->highlight (input, output, lang_name, fullname);
|
||||
contents = output.str ();
|
||||
contents = std::move (output).str ();
|
||||
already_styled = true;
|
||||
}
|
||||
catch (...)
|
||||
|
|
Loading…
Add table
Reference in a new issue