From: Tom Tromey <tom@tromey.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>
Subject: [FYI 1/2] Use std::string in rust_get_disr_info
Date: Wed, 09 Nov 2016 23:07:00 -0000 [thread overview]
Message-ID: <1478732828-14454-2-git-send-email-tom@tromey.com> (raw)
In-Reply-To: <1478732828-14454-1-git-send-email-tom@tromey.com>
This changes rust_get_disr_info to use std::string in one more spot,
avoiding a memory leak.
2016-11-09 Tom Tromey <tom@tromey.com>
* rust-lang.c (rust_get_disr_info): Use std::string in one more
spot.
---
gdb/ChangeLog | 5 +++++
gdb/rust-lang.c | 2 +-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 9123596..66a711a 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2016-11-09 Tom Tromey <tom@tromey.com>
+
+ * rust-lang.c (rust_get_disr_info): Use std::string in one more
+ spot.
+
2016-11-09 Pedro Alves <palves@redhat.com>
* ax-gdb.c (agent_eval_command_one): Use std::move instead of
diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c
index 295dae1..7d4bfc3 100644
--- a/gdb/rust-lang.c
+++ b/gdb/rust-lang.c
@@ -222,7 +222,7 @@ rust_get_disr_info (struct type *type, const gdb_byte *valaddr,
with the first field being the actual type works. */
const char *field_name = TYPE_NAME (TYPE_FIELD_TYPE (type, 0));
const char *last = rust_last_path_segment (field_name);
- ret.name = concat (TYPE_NAME (type), "::", last, (char *) NULL);
+ ret.name = std::string (TYPE_NAME (type)) + "::" + last;
ret.field_no = RUST_ENCODED_ENUM_REAL;
ret.is_encoded = 1;
return ret;
--
2.7.4
next prev parent reply other threads:[~2016-11-09 23:07 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-09 23:07 [FYI 0/2] C++ in the Rust code Tom Tromey
2016-11-09 23:07 ` Tom Tromey [this message]
2016-11-09 23:07 ` [FYI 2/2] Remove some cleanups from the rust code Tom Tromey
2016-11-09 23:40 ` [FYI 0/2] C++ in the Rust code Pedro Alves
2016-11-10 0:32 ` Pedro Alves
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=1478732828-14454-2-git-send-email-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