From: Tom Tromey Date: Sat, 31 Mar 2018 18:21:10 +0000 (-0600) Subject: Remove a string copy from event_location_to_sals X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9be2c17a900178df75a2208fd112ceb4325a70c1;p=binutils-gdb.git 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 * linespec.c (event_location_to_sals) : Remove a string copy. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 32ace23c132..b88f503b0c0 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2018-04-05 Tom Tromey + + * linespec.c (event_location_to_sals) : + Remove a string copy. + 2018-04-05 Tom Tromey * linespec.c (filter_results): Use std::vector. diff --git a/gdb/linespec.c b/gdb/linespec.c index 91dabb6117f..1e1ce2a2397 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),