Remove a string copy from event_location_to_sals
authorTom Tromey <tom@tromey.com>
Sat, 31 Mar 2018 18:21:10 +0000 (12:21 -0600)
committerTom Tromey <tom@tromey.com>
Thu, 5 Apr 2018 13:39:36 +0000 (07:39 -0600)
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.

gdb/ChangeLog
gdb/linespec.c

index 32ace23c132ff76fa31835f7c6705a327da2b88d..b88f503b0c0192b2565bb481e46f22e156ea3446 100644 (file)
@@ -1,3 +1,8 @@
+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.
index 91dabb6117fd211032197ee45964bc765e667de0..1e1ce2a2397df8be2f7af0b343a8a142ec64ceb6 100644 (file)
@@ -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),
This page took 0.028512 seconds and 4 git commands to generate.