From patchwork Wed Oct 19 01:12:15 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Alves X-Patchwork-Id: 16644 Received: (qmail 126525 invoked by alias); 19 Oct 2016 01:13:01 -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 125803 invoked by uid 89); 19 Oct 2016 01:12:51 -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=538, 7, 5387, Hx-languages-length:1278 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:12:45 +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 B3E3B155C3 for ; Wed, 19 Oct 2016 01:12:44 +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 u9J1CJjw019701 for ; Tue, 18 Oct 2016 21:12:44 -0400 From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH v2 27/31] Use ui_file_as_string in gdb/language.c Date: Wed, 19 Oct 2016 02:12:15 +0100 Message-Id: <1476839539-8374-28-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 * language.c (add_language): Use ui_file_as_string and adjust to use std::string. --- gdb/language.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/gdb/language.c b/gdb/language.c index 39faecc..2869d75 100644 --- a/gdb/language.c +++ b/gdb/language.c @@ -538,7 +538,6 @@ add_language (const struct language_defn *lang) /* For the "set language" command. */ static const char **language_names = NULL; /* For the "help set language" command. */ - char *language_set_doc = NULL; int i; struct ui_file *tmp_stream; @@ -609,19 +608,17 @@ add_language (const struct language_defn *lang) languages[i]->la_name + 1); } - language_set_doc = ui_file_xstrdup (tmp_stream, NULL); + std::string language_set_doc = ui_file_as_string (tmp_stream); ui_file_delete (tmp_stream); add_setshow_enum_cmd ("language", class_support, (const char **) language_names, &language, - language_set_doc, + language_set_doc.c_str (), _("Show the current source language."), NULL, set_language_command, show_language_command, &setlist, &showlist); - - xfree (language_set_doc); } /* Iterate through all registered languages looking for and calling