From: Tom Tromey <tom@tromey.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>
Subject: [RFA 1/5] Use std::string in break-catch-sig.c
Date: Thu, 22 Sep 2016 17:51:00 -0000 [thread overview]
Message-ID: <1474566656-15389-2-git-send-email-tom@tromey.com> (raw)
In-Reply-To: <1474566656-15389-1-git-send-email-tom@tromey.com>
This changes one spot in break-catch-sig.c to use std::string,
removing some cleanups.
2016-09-22 Tom Tromey <tom@tromey.com>
* break-catch-sig.c: Include <string>.
(signal_catchpoint_print_one): Use std::string.
---
gdb/ChangeLog | 5 +++++
gdb/break-catch-sig.c | 17 ++++++-----------
2 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index ea14f04..f9924e5 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2016-09-22 Tom Tromey <tom@tromey.com>
+
+ * break-catch-sig.c: Include <string>.
+ (signal_catchpoint_print_one): Use std::string.
+
2016-09-22 Edjunior Barbosa Machado <emachado@linux.vnet.ibm.com>
* rs6000-tdep.c (ppc_process_record_op31): Fix
diff --git a/gdb/break-catch-sig.c b/gdb/break-catch-sig.c
index 06ee44c..296f900 100644
--- a/gdb/break-catch-sig.c
+++ b/gdb/break-catch-sig.c
@@ -28,7 +28,8 @@
#include "valprint.h"
#include "cli/cli-utils.h"
#include "completer.h"
-#include "gdb_obstack.h"
+
+#include <string>
#define INTERNAL_SIGNAL(x) ((x) == GDB_SIGNAL_TRAP || (x) == GDB_SIGNAL_INT)
@@ -265,11 +266,7 @@ signal_catchpoint_print_one (struct breakpoint *b,
{
int i;
gdb_signal_type iter;
- struct obstack text;
- struct cleanup *cleanup;
-
- obstack_init (&text);
- cleanup = make_cleanup_obstack_free (&text);
+ std::string text;
for (i = 0;
VEC_iterate (gdb_signal_type, c->signals_to_be_caught, i, iter);
@@ -278,12 +275,10 @@ signal_catchpoint_print_one (struct breakpoint *b,
const char *name = signal_to_name_or_int (iter);
if (i > 0)
- obstack_grow (&text, " ", 1);
- obstack_grow (&text, name, strlen (name));
+ text += " ";
+ text += name;
}
- obstack_grow (&text, "", 1);
- ui_out_field_string (uiout, "what", (const char *) obstack_base (&text));
- do_cleanups (cleanup);
+ ui_out_field_string (uiout, "what", text.c_str ());
}
else
ui_out_field_string (uiout, "what",
--
2.7.4
next prev parent reply other threads:[~2016-09-22 17:51 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-22 17:51 [RFA 0/5] Some random C++-ification Tom Tromey
2016-09-22 17:51 ` [RFA 3/5] Use std::string, std::vector in rust-lang.c Tom Tromey
2016-09-22 19:03 ` Pedro Alves
2016-09-22 19:24 ` Tom Tromey
2016-09-22 19:35 ` Pedro Alves
2016-09-22 20:37 ` Pierre Muller
[not found] ` <57e4328a.c3c4620a.59d5b.803fSMTPIN_ADDED_BROKEN@mx.google.com>
2016-09-23 9:44 ` Pedro Alves
2016-09-23 15:56 ` Tom Tromey
2016-09-23 16:15 ` Pedro Alves
2016-09-22 17:51 ` Tom Tromey [this message]
2016-09-23 13:17 ` [RFA 1/5] Use std::string in break-catch-sig.c Yao Qi
2016-09-22 17:51 ` [RFA 2/5] Use std::string in cp-namespace.c Tom Tromey
2016-09-22 19:08 ` Pedro Alves
2016-09-22 20:56 ` Tom Tromey
2016-09-22 17:51 ` [RFA 4/5] Use std::vector in objfiles.c Tom Tromey
2016-09-22 19:03 ` [RFA 5/5] Use std::string rather than dyn-string Tom Tromey
2016-09-22 19:10 ` [RFA 0/5] Some random C++-ification Pedro Alves
2016-09-22 19:15 ` Pedro Alves
2016-09-22 23:10 ` Trevor Saunders
2016-09-23 15:47 ` Tom Tromey
2016-09-23 15:49 ` 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=1474566656-15389-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