From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 47177 invoked by alias); 16 Jan 2017 09:59:11 -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 47138 invoked by uid 89); 16 Jan 2017 09:59:09 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=BAYES_50,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 spammy=HTo:U*tom, mem_fileopen, ui_file_up, ui_file X-HELO: paperclip.tbsaunde.org Received: from tbsaunde.org (HELO paperclip.tbsaunde.org) (66.228.47.254) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 16 Jan 2017 09:59:08 +0000 Received: from ball (unknown [IPv6:2607:f0c8:8000:80e8:124a:7dff:fe34:eb17]) by paperclip.tbsaunde.org (Postfix) with ESMTPSA id 14E9FC08E; Mon, 16 Jan 2017 09:59:07 +0000 (UTC) Date: Mon, 16 Jan 2017 09:59:00 -0000 From: Trevor Saunders To: Tom Tromey Cc: gdb-patches@sourceware.org Subject: Re: [RFA 2/5] Introduce ui_file_up and use it to remove cleanups Message-ID: <20170116100928.e7hzuhtuffguzcnq@ball> References: <20170115134253.24018-1-tom@tromey.com> <20170115134253.24018-3-tom@tromey.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170115134253.24018-3-tom@tromey.com> User-Agent: NeoMutt/20161126 (1.7.1) X-SW-Source: 2017-01/txt/msg00284.txt.bz2 > +++ b/gdb/ada-lang.c > @@ -7602,16 +7602,11 @@ ada_value_struct_elt (struct value *arg, char *name, int no_err) > static std::string > type_as_string (struct type *type) > { > - struct ui_file *tmp_stream = mem_fileopen (); > - struct cleanup *old_chain; > - > - tmp_stream = mem_fileopen (); > - old_chain = make_cleanup_ui_file_delete (tmp_stream); > + ui_file_up tmp_stream = mem_fileopen (); > > - type_print (type, "", tmp_stream, -1); > - std::string str = ui_file_as_string (tmp_stream); > + type_print (type, "", tmp_stream.get (), -1); > + std::string str = ui_file_as_string (tmp_stream.get ()); > > - do_cleanups (old_chain); > return str; you could just get rid of the str variable here and a bunch of other places right? Though obviously that can happen later. Trev