From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 130462 invoked by alias); 31 Jul 2017 19:25:10 -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 130333 invoked by uid 89); 31 Jul 2017 19:25:06 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.8 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 spammy=tui, Hx-languages-length:1709 X-HELO: smtp.polymtl.ca Received: from smtp.polymtl.ca (HELO smtp.polymtl.ca) (132.207.4.11) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 31 Jul 2017 19:25:05 +0000 Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id v6VJOxIY018894 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 31 Jul 2017 15:25:03 -0400 Received: by simark.ca (Postfix, from userid 112) id 38BBC1EA05; Mon, 31 Jul 2017 15:24:59 -0400 (EDT) Received: from simark.ca (localhost [127.0.0.1]) by simark.ca (Postfix) with ESMTP id 1873C1E5B1; Mon, 31 Jul 2017 15:24:48 -0400 (EDT) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Mon, 31 Jul 2017 19:25:00 -0000 From: Simon Marchi To: Tom Tromey Cc: gdb-patches@sourceware.org Subject: Re: [RFA v2 14/24] Use unique_xmalloc_ptr in jit.c In-Reply-To: <20170725172107.9799-15-tom@tromey.com> References: <20170725172107.9799-1-tom@tromey.com> <20170725172107.9799-15-tom@tromey.com> Message-ID: <8ed5723c63a33fb707b8df6307c95bf2@polymtl.ca> X-Sender: simon.marchi@polymtl.ca User-Agent: Roundcube Webmail/1.3.0 X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Mon, 31 Jul 2017 19:24:59 +0000 X-IsSubscribed: yes X-SW-Source: 2017-07/txt/msg00454.txt.bz2 On 2017-07-25 19:20, Tom Tromey wrote: > This removes some cleanups from jit.c by using unique_xmalloc_ptr > instead. > > ChangeLog > 2017-07-25 Tom Tromey > > * jit.c (jit_reader_load_command): Use unique_xmalloc_ptr. > --- > gdb/ChangeLog | 4 ++++ > gdb/jit.c | 20 ++++++-------------- > 2 files changed, 10 insertions(+), 14 deletions(-) > > diff --git a/gdb/ChangeLog b/gdb/ChangeLog > index 1ba2801..a08aa29 100644 > --- a/gdb/ChangeLog > +++ b/gdb/ChangeLog > @@ -1,5 +1,9 @@ > 2017-07-25 Tom Tromey > > + * jit.c (jit_reader_load_command): Use unique_xmalloc_ptr. > + > +2017-07-25 Tom Tromey > + > * tui/tui-regs.c (tui_restore_gdbout): Remove. > (tui_register_format): Use scoped_restore. > > diff --git a/gdb/jit.c b/gdb/jit.c > index ddf1005..15b93fe 100644 > --- a/gdb/jit.c > +++ b/gdb/jit.c > @@ -211,29 +211,21 @@ jit_reader_load (const char *file_name) > static void > jit_reader_load_command (char *args, int from_tty) > { > - char *so_name; > - struct cleanup *prev_cleanup; > - > if (args == NULL) > error (_("No reader name provided.")); > - args = tilde_expand (args); > - prev_cleanup = make_cleanup (xfree, args); > + gdb::unique_xmalloc_ptr file (tilde_expand (args)); > > if (loaded_jit_reader != NULL) > error (_("JIT reader already loaded. Run jit-reader-unload > first.")); > > - if (IS_ABSOLUTE_PATH (args)) > - so_name = args; > - else > - { > - so_name = xstrprintf ("%s%s%s", jit_reader_dir, SLASH_STRING, > args); > - make_cleanup (xfree, so_name); > - } > + gdb::unique_xmalloc_ptr so_name; The so_name variable is now unused. LGTM with that changed. Simon