From: Tom Tromey <tom@tromey.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>
Subject: [RFA v2 06/10] Remove a string copy from event_location_to_sals
Date: Wed, 04 Apr 2018 04:41:00 -0000 [thread overview]
Message-ID: <20180404044049.31481-7-tom@tromey.com> (raw)
In-Reply-To: <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
next prev parent reply other threads:[~2018-04-04 4:40 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-04 4:40 [RFA v2 00/10] Remove some cleanups from linespec.c Tom Tromey
2018-04-04 4:40 ` [RFA v2 02/10] Fix some indentation in linespec.c Tom Tromey
2018-04-04 4:40 ` [RFA v2 07/10] Change streq to return bool Tom Tromey
2018-04-04 4:41 ` [RFA v2 09/10] Remove typep and VEC(typep) from linespec.c Tom Tromey
2018-04-04 4:41 ` Tom Tromey [this message]
2018-04-04 4:41 ` [RFA v2 10/10] Remove unnecessary include from linespec.h Tom Tromey
2018-04-04 4:41 ` [RFA v2 01/10] Remove some cleanups from search_minsyms_for_name Tom Tromey
2018-04-04 4:41 ` [RFA v2 03/10] Make copy_token_string return unique_xmalloc_ptr Tom Tromey
2018-04-04 4:41 ` [RFA v2 04/10] Return std::string from canonical_to_fullform Tom Tromey
2018-04-04 4:41 ` [RFA v2 08/10] More use of std::vector in linespec.c Tom Tromey
2018-04-04 4:41 ` [RFA v2 05/10] Have filter_results take a std::vector Tom Tromey
2018-04-05 3:08 ` [RFA v2 00/10] Remove some cleanups from linespec.c Simon Marchi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180404044049.31481-7-tom@tromey.com \
--to=tom@tromey.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).