From patchwork Fri Sep 23 19:52:58 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 15963 Received: (qmail 48150 invoked by alias); 23 Sep 2016 19:53:30 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 48085 invoked by uid 89); 23 Sep 2016 19:53:30 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.3 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM, SPF_PASS autolearn=no version=3.3.2 spammy=H*r:4.86_1, H*F:U*tom, 2667 X-HELO: gproxy5-pub.mail.unifiedlayer.com Received: from gproxy5-pub.mail.unifiedlayer.com (HELO gproxy5-pub.mail.unifiedlayer.com) (67.222.38.55) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with SMTP; Fri, 23 Sep 2016 19:53:13 +0000 Received: (qmail 16639 invoked by uid 0); 23 Sep 2016 19:53:11 -0000 Received: from unknown (HELO cmgw4) (10.0.90.85) by gproxy5.mail.unifiedlayer.com with SMTP; 23 Sep 2016 19:53:11 -0000 Received: from box522.bluehost.com ([74.220.219.122]) by cmgw4 with id n7t51t00X2f2jeq017t8lF; Fri, 23 Sep 2016 13:53:11 -0600 X-Authority-Analysis: v=2.1 cv=Hq7lRSjS c=1 sm=1 tr=0 a=GsOEXm/OWkKvwdLVJsfwcA==:117 a=GsOEXm/OWkKvwdLVJsfwcA==:17 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=GW1xBdLrtEIA:10 a=zstS-IiYAAAA:8 a=xtr-DYKAd0rIWNUx9eMA:9 a=4G6NA9xxw8l3yy4pmD5M:22 Received: from 174-16-151-161.hlrn.qwest.net ([174.16.151.161]:55642 helo=bapiya.Home) by box522.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.86_1) (envelope-from ) id 1bnWWv-0005Ed-3k; Fri, 23 Sep 2016 13:53:05 -0600 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [FYI v2 1/5] Use std::string in break-catch-sig.c Date: Fri, 23 Sep 2016 13:52:58 -0600 Message-Id: <1474660382-14294-2-git-send-email-tom@tromey.com> In-Reply-To: <1474660382-14294-1-git-send-email-tom@tromey.com> References: <1474660382-14294-1-git-send-email-tom@tromey.com> X-BWhitelist: no X-Exim-ID: 1bnWWv-0005Ed-3k X-Source-Sender: 174-16-151-161.hlrn.qwest.net (bapiya.Home) [174.16.151.161]:55642 X-Source-Auth: tom+tromey.com X-Email-Count: 2 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTIyLmJsdWVob3N0LmNvbQ== This changes one spot in break-catch-sig.c to use std::string, removing some cleanups. 2016-09-23 Tom Tromey * break-catch-sig.c: Include . (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 fe3ea42..8c8b18a 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,10 @@ 2016-09-23 Tom Tromey + * break-catch-sig.c: Include . + (signal_catchpoint_print_one): Use std::string. + +2016-09-23 Tom Tromey + * utils.c (struct restore_ui_out_closure): Remove. * objfiles.h (terminate_minimal_symbol_table): Don't declare. 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 #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",