From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22793 invoked by alias); 19 Oct 2016 01:21:45 -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 22722 invoked by uid 89); 19 Oct 2016 01:21:44 -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=Hx-languages-length:1042 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:21:43 +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 15C45C057EC9 for ; Wed, 19 Oct 2016 01:12:35 +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 u9J1CJjl019701 for ; Tue, 18 Oct 2016 21:12:34 -0400 From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH v2 16/31] Use ui_file_as_string in gdb/top.c Date: Wed, 19 Oct 2016 01:21:00 -0000 Message-Id: <1476839539-8374-17-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> X-SW-Source: 2016-10/txt/msg00552.txt.bz2 Yet another cleanup is eliminated. gdb/ChangeLog: yyyy-mm-dd Pedro Alves * top.c (quit_confirm): Use ui_file_as_string and std::string. --- gdb/top.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/gdb/top.c b/gdb/top.c index 762a9a8..4fa9cfb 100644 --- a/gdb/top.c +++ b/gdb/top.c @@ -1577,8 +1577,6 @@ quit_confirm (void) { struct ui_file *stb; struct cleanup *old_chain; - char *str; - int qr; /* Don't even ask if we're only debugging a core file inferior. */ if (!have_live_inferiors ()) @@ -1592,12 +1590,11 @@ quit_confirm (void) iterate_over_inferiors (print_inferior_quit_action, stb); fprintf_filtered (stb, _("\nQuit anyway? ")); - str = ui_file_xstrdup (stb, NULL); - make_cleanup (xfree, str); + std::string str = ui_file_as_string (stb); - qr = query ("%s", str); do_cleanups (old_chain); - return qr; + + return query ("%s", str.c_str ()); } /* Prepare to exit GDB cleanly by undoing any changes made to the -- 2.5.5