From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25802 invoked by alias); 22 Dec 2017 11:32:52 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 25683 invoked by uid 89); 22 Dec 2017 11:32:51 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.4 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=ify X-HELO: rock.gnat.com Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 22 Dec 2017 11:32:50 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 1091711728D; Fri, 22 Dec 2017 06:32:49 -0500 (EST) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id r9bAtVV1TOXQ; Fri, 22 Dec 2017 06:32:49 -0500 (EST) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id BCBDB11728C; Fri, 22 Dec 2017 06:32:47 -0500 (EST) Received: by joel.gnat.com (Postfix, from userid 1000) id 1248C85CDF; Fri, 22 Dec 2017 15:32:38 +0400 (+04) Date: Fri, 22 Dec 2017 11:32:00 -0000 From: Joel Brobecker To: Xavier Roirand Cc: gdb-patches@sourceware.org Subject: Re: [RFA] Removes xfree/cleanup and C++fy in two exception functions. Message-ID: <20171222113238.iljgn5sgvs3bfymc@adacore.com> References: <1513940981-32741-1-git-send-email-roirand@adacore.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1513940981-32741-1-git-send-email-roirand@adacore.com> User-Agent: NeoMutt/20170113 (1.7.2) X-SW-Source: 2017-12/txt/msg00477.txt.bz2 Thanks Xavier. > This remove xstrprintf/xfree use and C++fy in two exception functions. remove -> removes. C++fy -> C++ify or C++-ify. But, rather than saying "C++ify", let's be more specific and just say that we use C++ to remote a cleanup (that's the objective, right?). > gdb/ChangeLog: > > * ada-lang.c (print_one_exception): Remove xstrprintf/xfree use. > (print_mention_exception): C++fy. Same here: Let's be a bit more specific that just a mysterious C++ify. Pre-approved with those changes above. > Tested on x86_64-linux. > --- > gdb/ada-lang.c | 15 ++++++--------- > 1 file changed, 6 insertions(+), 9 deletions(-) > > diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c > index dad2b17..03f3e56 100644 > --- a/gdb/ada-lang.c > +++ b/gdb/ada-lang.c > @@ -12745,10 +12745,9 @@ print_one_exception (enum ada_exception_catchpoint_kind ex, > case ada_catch_exception: > if (c->excep_string != NULL) > { > - char *msg = xstrprintf (_("`%s' Ada exception"), c->excep_string); > - > - uiout->field_string ("what", msg); > - xfree (msg); > + uiout->field_fmt ("what", > + _("`%s' Ada exception"), > + c->excep_string); > } > else > uiout->field_string ("what", "all Ada exceptions"); > @@ -12789,11 +12788,9 @@ print_mention_exception (enum ada_exception_catchpoint_kind ex, > case ada_catch_exception: > if (c->excep_string != NULL) > { > - char *info = xstrprintf (_("`%s' Ada exception"), c->excep_string); > - struct cleanup *old_chain = make_cleanup (xfree, info); > - > - uiout->text (info); > - do_cleanups (old_chain); > + std::string info = string_printf (_("`%s' Ada exception"), > + c->excep_string); > + uiout->text (info.c_str ()); > } > else > uiout->text (_("all Ada exceptions")); > -- > 2.7.4 -- Joel