From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 37091 invoked by alias); 3 Nov 2017 01:02:30 -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 37082 invoked by uid 89); 3 Nov 2017 01:02:30 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 spammy=H*r:112, rfa 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; Fri, 03 Nov 2017 01:02:29 +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 vA312Moq003972 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 2 Nov 2017 21:02:27 -0400 Received: by simark.ca (Postfix, from userid 112) id 688F41E526; Thu, 2 Nov 2017 21:02:22 -0400 (EDT) Received: from simark.ca (localhost [127.0.0.1]) by simark.ca (Postfix) with ESMTP id E34D91E4C4; Thu, 2 Nov 2017 21:02:21 -0400 (EDT) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Fri, 03 Nov 2017 01:02:00 -0000 From: Simon Marchi To: Tom Tromey Cc: gdb-patches@sourceware.org Subject: Re: [RFA 04/13] Use unique_xmalloc_ptr in find_separate_debug_file_by_debuglink In-Reply-To: <20171102223612.3642-5-tom@tromey.com> References: <20171102223612.3642-1-tom@tromey.com> <20171102223612.3642-5-tom@tromey.com> Message-ID: X-Sender: simon.marchi@polymtl.ca User-Agent: Roundcube Webmail/1.3.2 X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Fri, 3 Nov 2017 01:02:22 +0000 X-IsSubscribed: yes X-SW-Source: 2017-11/txt/msg00056.txt.bz2 On 2017-11-02 18:36, Tom Tromey wrote: > @@ -1580,19 +1575,17 @@ find_separate_debug_file_by_debuglink (struct > objfile *objfile) > if (lstat (objfile_name (objfile), &st_buf) == 0 > && S_ISLNK (st_buf.st_mode)) > { > - char *symlink_dir; > - > - symlink_dir = lrealpath (objfile_name (objfile)); > + gdb::unique_xmalloc_ptr symlink_dir > + (lrealpath (objfile_name (objfile))); > if (symlink_dir != NULL) > { > - make_cleanup (xfree, symlink_dir); > - terminate_after_last_dir_separator (symlink_dir); > - if (strcmp (dir, symlink_dir) != 0) > + terminate_after_last_dir_separator (symlink_dir.get ()); > + if (strcmp (dir.c_str (), symlink_dir.get ()) != 0) Just one tiny nit: when possible, I like to replace strcmp with std::string's operator== if (dir == symlink_dir.get ()) but I'll leave it up to you. Simon