From patchwork Fri Dec 22 11:09:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xavier Roirand X-Patchwork-Id: 25071 Received: (qmail 86770 invoked by alias); 22 Dec 2017 11:09:54 -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 86760 invoked by uid 89); 22 Dec 2017 11:09:53 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.1 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_NEUTRAL autolearn=ham version=3.3.2 spammy= X-HELO: mail-wr0-f182.google.com Received: from mail-wr0-f182.google.com (HELO mail-wr0-f182.google.com) (209.85.128.182) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 22 Dec 2017 11:09:52 +0000 Received: by mail-wr0-f182.google.com with SMTP id h1so27576647wre.12 for ; Fri, 22 Dec 2017 03:09:51 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=EjB/uNPO2nb2OEqJyiyDCGd9NuBJtBPaEyqM440wsuc=; b=kdDDiYC31VZaVe+KCS5BqJTuaSx2kc18TN1GCpTJMiAjMbqLZEhAVFeIrcnEfB4lk/ runqmytyIasqFZUsIxjneGALYUjHB5FfARHbzFZ2UYWf82hVunNQOLh2hq+c6VqeZNDo IV0rBvFH+jnN0iohC8wuEWHeb9SHlufV2Xbw0027uS7mnfqSJBCdZX8BLbSsdlTGq2n5 sj8nFZrTMbvnIxLZvS2nqt4xV/4Qeu+obNee9PvRFy751CM/gOHCfp1wudW1u2QppcAb B6FgDpyGtrvupo2tX+UjiHmOLNVtldeZaUy+zimPdz2JwIcPOrdJrYPd7NeY7KysNVp+ H/0Q== X-Gm-Message-State: AKGB3mJkz+gxKFggpoLz0ToXlveiNzM899Fg9GR8dGvQ3Z5jfbNe5DV8 VtMphAi1Mmzm8W24O89fpqdM5QBa X-Google-Smtp-Source: ACJfBosmDnAIjcaE44GwYURnlTjhBZufA1sw0D7cx+KKFuwimH51SO3/W3MRE9iKe4O4uaPpwl2PWg== X-Received: by 10.223.193.141 with SMTP id x13mr7506631wre.239.1513940989626; Fri, 22 Dec 2017 03:09:49 -0800 (PST) Received: from adacore.com ([46.18.100.10]) by smtp.gmail.com with ESMTPSA id d9sm15641685wrf.45.2017.12.22.03.09.47 (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 22 Dec 2017 03:09:48 -0800 (PST) Received: by adacore.com (sSMTP sendmail emulation); Fri, 22 Dec 2017 12:09:45 +0100 From: Xavier Roirand To: gdb-patches@sourceware.org Cc: Xavier Roirand , brobecker@adacore.com Subject: [RFA] Removes xfree/cleanup and C++fy in two exception functions. Date: Fri, 22 Dec 2017 12:09:41 +0100 Message-Id: <1513940981-32741-1-git-send-email-roirand@adacore.com> X-IsSubscribed: yes This remove xstrprintf/xfree use and C++fy in two exception functions. gdb/ChangeLog: * ada-lang.c (print_one_exception): Remove xstrprintf/xfree use. (print_mention_exception): C++fy. 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"));