This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[RFA v2 06/10] Remove a string copy from event_location_to_sals
- From: Tom Tromey <tom at tromey dot com>
- To: gdb-patches at sourceware dot org
- Cc: Tom Tromey <tom at tromey dot com>
- Date: Tue, 3 Apr 2018 22:40:45 -0600
- Subject: [RFA v2 06/10] Remove a string copy from event_location_to_sals
- References: <20180404044049.31481-1-tom@tromey.com>
The use of "const" showed that a string copy in event_location_to_sals
was unnecessary. This patch removes it.
gdb/ChangeLog
2018-04-03 Tom Tromey <tom@tromey.com>
* linespec.c (event_location_to_sals) <case ADDRESS_LOCATION>:
Remove a string copy.
---
gdb/ChangeLog | 5 +++++
gdb/linespec.c | 8 +-------
2 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/gdb/linespec.c b/gdb/linespec.c
index 91dabb6117..1e1ce2a239 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),
--
2.13.6