]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit - gdb/ChangeLog
gdb: avoid unnecessary string copy in auto_load_objfile_script_1
authorSimon Marchi <simon.marchi@polymtl.ca>
Mon, 5 Oct 2020 13:02:42 +0000 (09:02 -0400)
committerSimon Marchi <simon.marchi@polymtl.ca>
Mon, 5 Oct 2020 13:03:09 +0000 (09:03 -0400)
commit7d1441178ac6d5b31e3ebf312012c2d5bfaeec91
tree752eb8287e0296cf2f176b3fbf4659a91345b49a
parent6d96a5946d1ec76fea79bc36aa95d7d3dd304200
gdb: avoid unnecessary string copy in auto_load_objfile_script_1

Assigning the result of STRIP_DRIVE_SPEC to an std::string creates an
unnecessary copy of the string.  STRIP_DRIVE_SPEC is defined as:

  #define STRIP_DRIVE_SPEC(f) ((f) + 2)

So if it is passed a "const char *", it returns a "const char *".  We
could use a "const char *" intermediary variable instead of an
std::string, or (as implemented in this patch) just use it directly in
the concatenation right after.

gdb/ChangeLog:

* auto-load.c (auto_load_objfile_script_1): Don't use
debugfile_holder as temporary variable when stripping drive
letter.

Change-Id: If2ccc7a156b22100754d9cdf6778ac7eeb93da4c
gdb/ChangeLog
gdb/auto-load.c