diff options
author | Tom Tromey <tromey@adacore.com> | 2023-09-21 13:31:14 -0600 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2023-09-26 06:56:27 -0600 |
commit | 0128542673364609a0b2e1d8a3f1896fc89584d2 (patch) | |
tree | 7fc0d5156d268d72c27fcc548fad9fded59def6c /gdb/top.c | |
parent | Automatic date update in version.in (diff) | |
download | binutils-gdb-0128542673364609a0b2e1d8a3f1896fc89584d2.tar.gz binutils-gdb-0128542673364609a0b2e1d8a3f1896fc89584d2.tar.bz2 binutils-gdb-0128542673364609a0b2e1d8a3f1896fc89584d2.zip |
Use string_file::release in some places
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>
Diffstat (limited to 'gdb/top.c')
-rw-r--r-- | gdb/top.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/gdb/top.c b/gdb/top.c index 2322e55f1db..cbe14b01046 100644 --- a/gdb/top.c +++ b/gdb/top.c @@ -647,12 +647,12 @@ execute_fn_to_string (std::string &res, std::function<void(void)> fn, 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. */ |