diff options
author | Tom Tromey <tom@tromey.com> | 2018-03-31 12:21:10 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2018-04-05 07:39:36 -0600 |
commit | 9be2c17a900178df75a2208fd112ceb4325a70c1 (patch) | |
tree | a22e6175b1a96c74622746475ddf31d856dc0c42 | |
parent | f73c6ece7888af880d3b03b2d57ee7782f2a539b (diff) | |
download | fsf-binutils-gdb-9be2c17a900178df75a2208fd112ceb4325a70c1.zip fsf-binutils-gdb-9be2c17a900178df75a2208fd112ceb4325a70c1.tar.gz fsf-binutils-gdb-9be2c17a900178df75a2208fd112ceb4325a70c1.tar.bz2 |
Remove a string copy from event_location_to_sals
The use of "const" showed that a string copy in event_location_to_sals
was unnecessary. This patch removes it.
ChangeLog
2018-04-05 Tom Tromey <tom@tromey.com>
* linespec.c (event_location_to_sals) <case ADDRESS_LOCATION>:
Remove a string copy.
-rw-r--r-- | gdb/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/linespec.c | 8 |
2 files changed, 6 insertions, 7 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 32ace23..b88f503 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,10 @@ 2018-04-05 Tom Tromey <tom@tromey.com> + * linespec.c (event_location_to_sals) <case ADDRESS_LOCATION>: + Remove a string copy. + +2018-04-05 Tom Tromey <tom@tromey.com> + * linespec.c (filter_results): Use std::vector. (decode_line_2, decode_line_full): Update. diff --git a/gdb/linespec.c b/gdb/linespec.c index 91dabb6..1e1ce2a 100644 --- a/gdb/linespec.c +++ b/gdb/linespec.c @@ -3165,16 +3165,10 @@ event_location_to_sals (linespec_parser *parser, if (addr_string != NULL) { - char *expr = xstrdup (addr_string); - const char *const_expr = expr; - struct cleanup *cleanup = make_cleanup (xfree, expr); - - addr = linespec_expression_to_pc (&const_expr); + addr = linespec_expression_to_pc (&addr_string); if (PARSER_STATE (parser)->canonical != NULL) PARSER_STATE (parser)->canonical->location = copy_event_location (location); - - do_cleanups (cleanup); } result = convert_address_location_to_sals (PARSER_STATE (parser), |