From patchwork Thu Sep 28 19:50:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 23204 Received: (qmail 10519 invoked by alias); 28 Sep 2017 19:50:21 -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 10412 invoked by uid 89); 28 Sep 2017 19:50:21 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.2 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_SORBS_SPAM, SPF_PASS autolearn=ham version=3.3.2 spammy=xxx X-HELO: gproxy8-pub.mail.unifiedlayer.com Received: from gproxy8-pub.mail.unifiedlayer.com (HELO gproxy8-pub.mail.unifiedlayer.com) (67.222.33.93) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 28 Sep 2017 19:50:20 +0000 Received: from cmgw2 (unknown [10.0.90.83]) by gproxy8.mail.unifiedlayer.com (Postfix) with ESMTP id C8B251AB356 for ; Thu, 28 Sep 2017 13:50:18 -0600 (MDT) Received: from box522.bluehost.com ([74.220.219.122]) by cmgw2 with id F7qF1w03H2f2jeq017qJd7; Thu, 28 Sep 2017 13:50:18 -0600 X-Authority-Analysis: v=2.2 cv=dZfw5Tfe c=1 sm=1 tr=0 a=GsOEXm/OWkKvwdLVJsfwcA==:117 a=GsOEXm/OWkKvwdLVJsfwcA==:17 a=2JCJgTwv5E4A:10 a=zstS-IiYAAAA:8 a=iQYtyKrOEti8UI-rDJsA:9 a=4G6NA9xxw8l3yy4pmD5M:22 Received: from 75-166-0-208.hlrn.qwest.net ([75.166.0.208]:56208 helo=bapiya.Home) by box522.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.87) (envelope-from ) id 1dxep5-003LpU-Ha; Thu, 28 Sep 2017 13:50:15 -0600 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [RFA 08/12] Remove cleanup from complaints.c Date: Thu, 28 Sep 2017 13:50:07 -0600 Message-Id: <20170928195011.27382-9-tom@tromey.com> In-Reply-To: <20170928195011.27382-1-tom@tromey.com> References: <20170928195011.27382-1-tom@tromey.com> X-BWhitelist: no X-Exim-ID: 1dxep5-003LpU-Ha X-Source-Sender: 75-166-0-208.hlrn.qwest.net (bapiya.Home) [75.166.0.208]:56208 X-Source-Auth: tom+tromey.com X-Email-Count: 9 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTIyLmJsdWVob3N0LmNvbQ== X-Local-Domain: yes This removes a cleanup from complaints.c by using std::string. gdb/ChangeLog 2017-09-28 Tom Tromey * complaints.c (vcomplaint): Use std::string. --- gdb/ChangeLog | 4 ++++ gdb/complaints.c | 9 +++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/gdb/complaints.c b/gdb/complaints.c index aba305c..6456cae 100644 --- a/gdb/complaints.c +++ b/gdb/complaints.c @@ -192,16 +192,14 @@ vcomplaint (struct complaints **c, const char *file, vwarning (fmt, args); else { - char *msg; - struct cleanup *cleanups; - msg = xstrvprintf (fmt, args); - cleanups = make_cleanup (xfree, msg); + std::string msg (string_vprintf (fmt, args)); wrap_here (""); if (series != SUBSEQUENT_MESSAGE) begin_line (); /* XXX: i18n */ fprintf_filtered (gdb_stderr, "%s%s%s", - complaints->explanation[series].prefix, msg, + complaints->explanation[series].prefix, + msg.c_str (), complaints->explanation[series].postfix); /* Force a line-break after any isolated message. For the other cases, clear_complaints() takes care of any missing @@ -214,7 +212,6 @@ vcomplaint (struct complaints **c, const char *file, fputs_filtered ("\n", gdb_stderr); else wrap_here (""); - do_cleanups (cleanups); } }