I found a few spots like:
string_file f;
std::string x = f.string ();
However, string_file::string returns a 'const std::string &'... so it
seems to me that this must be copying the string (? I find it hard to
reason about this in C++).
This patch changes these spots to use release() instead, which moves
the string.
Reviewed-by: Keith Seitz <keiths@redhat.com>
Reviewed-by: Lancelot Six <lancelot.six@amd.com>
string_file stb;
ui_out_redirect_pop redir (current_uiout, &stb);
print_breakpoint_location (this->owner, this);
- return stb.string ();
+ return stb.release ();
}
/* Decrement reference count. If the reference count reaches 0,
catch (...)
{
/* Finally. */
- res = std::move (str_file.string ());
+ res = str_file.release ();
throw;
}
/* And finally. */
- res = std::move (str_file.string ());
+ res = str_file.release ();
}
/* See gdbcmd.h. */