aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@polymtl.ca>2026-03-01 22:26:06 -0500
committerSimon Marchi <simon.marchi@polymtl.ca>2026-03-01 22:27:55 -0500
commitbd0babf07de17da6e8e536ceb4dd940d0ed6a0d0 (patch)
treee100b0028974573e36342cc1773f7266bd3d96c2
parentdd9a411627a249b7b3dfb4ad879c62d862dc93e3 (diff)
downloadbinutils-master.zip
binutils-master.tar.gz
binutils-master.tar.bz2
gdb/linux-tdep: pass string by referenceHEADmaster
Sonarqube in me IDE pointed out this "const string" parameter that should be a reference. I then looked at the callers, and saw that one would pass `.c_str()`, causing an unnecessary copy, and the other using std::move unnecessarily. Change-Id: I29a84a9d2fad79ac68a66a95553a30173fa3544c
-rw-r--r--gdb/linux-tdep.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c
index 1cd35e5..2bf35a2 100644
--- a/gdb/linux-tdep.c
+++ b/gdb/linux-tdep.c
@@ -1384,7 +1384,7 @@ typedef bool linux_dump_mapping_p_ftype (filter_flags filterflags,
static std::vector<struct smaps_data>
parse_smaps_data (const char *data,
- const std::string maps_filename)
+ const std::string &maps_filename)
{
char *line, *t;
@@ -1633,7 +1633,7 @@ linux_find_memory_regions_full (struct gdbarch *gdbarch,
/* Parse the contents of smaps into a vector. */
std::vector<struct smaps_data> smaps
- = parse_smaps_data (data.get (), maps_filename.c_str ());
+ = parse_smaps_data (data.get (), maps_filename);
for (const struct smaps_data &map : smaps)
{
@@ -3100,7 +3100,7 @@ linux_address_in_shadow_stack_mem_range
return false;
const std::vector<smaps_data> smaps
- = parse_smaps_data (data.get (), std::move (smaps_file));
+ = parse_smaps_data (data.get (), smaps_file);
auto find_addr_mem_range = [&addr] (const smaps_data &map)
{