From patchwork Wed Oct 19 01:11:57 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Alves X-Patchwork-Id: 16650 Received: (qmail 12514 invoked by alias); 19 Oct 2016 01:17:40 -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 12487 invoked by uid 89); 19 Oct 2016 01:17:39 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=sk:xtensa_ X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 19 Oct 2016 01:17:38 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 41CC331B303 for ; Wed, 19 Oct 2016 01:12:29 +0000 (UTC) Received: from cascais.lan (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u9J1CJje019701 for ; Tue, 18 Oct 2016 21:12:28 -0400 From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH v2 09/31] Use ui_file_as_string in gdb/xtensa-tdep.c Date: Wed, 19 Oct 2016 02:11:57 +0100 Message-Id: <1476839539-8374-10-git-send-email-palves@redhat.com> In-Reply-To: <1476839539-8374-1-git-send-email-palves@redhat.com> References: <1476839539-8374-1-git-send-email-palves@redhat.com> gdb/ChangeLog: yyyy-mm-yy Pedro Alves * xtensa-tdep.c (xtensa_verify_config): Use ui_file_as_string and std::string. --- gdb/xtensa-tdep.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/gdb/xtensa-tdep.c b/gdb/xtensa-tdep.c index aafb175..68890ff 100644 --- a/gdb/xtensa-tdep.c +++ b/gdb/xtensa-tdep.c @@ -3065,8 +3065,6 @@ xtensa_verify_config (struct gdbarch *gdbarch) struct ui_file *log; struct cleanup *cleanups; struct gdbarch_tdep *tdep; - long length; - char *buf; tdep = gdbarch_tdep (gdbarch); log = mem_fileopen (); @@ -3098,11 +3096,10 @@ xtensa_verify_config (struct gdbarch *gdbarch) if (tdep->a0_base == -1) fprintf_unfiltered (log, _("\n\ta0_base: No Ax registers")); - buf = ui_file_xstrdup (log, &length); - make_cleanup (xfree, buf); - if (length > 0) + std::string buf = ui_file_as_string (log); + if (!buf.empty ()) internal_error (__FILE__, __LINE__, - _("the following are invalid: %s"), buf); + _("the following are invalid: %s"), buf.c_str ()); do_cleanups (cleanups); }