From patchwork Wed Oct 19 01:12:05 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Alves X-Patchwork-Id: 16659 Received: (qmail 24043 invoked by alias); 19 Oct 2016 01:21:55 -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 23604 invoked by uid 89); 19 Oct 2016 01:21:52 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.2 required=5.0 tests=BAYES_00, KAM_LAZY_DOMAIN_SECURITY, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=no version=3.3.2 spammy= 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:50 +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 DB7B48AE72 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 u9J1CJjm019701 for ; Tue, 18 Oct 2016 21:12:35 -0400 From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH v2 17/31] Use ui_file_as_string in gdb/printcmd.c Date: Wed, 19 Oct 2016 02:12:05 +0100 Message-Id: <1476839539-8374-18-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> Yet another cleanup eliminated. gdb/ChangeLog: yyyy-mm-yy Pedro Alves * printcmd.c (eval_command): Use ui_file_as_string and std::string. --- gdb/printcmd.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/gdb/printcmd.c b/gdb/printcmd.c index aa51848..d909823 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -2721,14 +2721,12 @@ eval_command (char *arg, int from_tty) { struct ui_file *ui_out = mem_fileopen (); struct cleanup *cleanups = make_cleanup_ui_file_delete (ui_out); - char *expanded; ui_printf (arg, ui_out); - expanded = ui_file_xstrdup (ui_out, NULL); - make_cleanup (xfree, expanded); + std::string expanded = ui_file_as_string (ui_out); - execute_command (expanded, from_tty); + execute_command (&expanded[0], from_tty); do_cleanups (cleanups); }