From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 67118 invoked by alias); 12 Feb 2019 16:52:26 -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 67109 invoked by uid 89); 12 Feb 2019 16:52:26 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_PASS autolearn=ham version=3.3.2 spammy=HContent-Transfer-Encoding:8bit X-HELO: mx2.freebsd.org Received: from mx2.freebsd.org (HELO mx2.freebsd.org) (8.8.178.116) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 12 Feb 2019 16:52:24 +0000 Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client CN "mx1.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx2.freebsd.org (Postfix) with ESMTPS id 9532D76AAA; Tue, 12 Feb 2019 16:52:20 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BEBEC6E2C8; Tue, 12 Feb 2019 16:52:19 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro-3.local (ralph.baldwin.cx [66.234.199.215]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 52FD513040; Tue, 12 Feb 2019 16:52:19 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: [PATCH v2 2/4] Add a new function child_path. To: Simon Marchi , gdb-patches@sourceware.org References: From: John Baldwin Openpgp: preference=signencrypt Message-ID: <19c13b48-63d4-581e-76f4-96b7dd3cd158@FreeBSD.org> Date: Tue, 12 Feb 2019 16:52:00 -0000 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:60.0) Gecko/20100101 Thunderbird/60.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: BEBEC6E2C8 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.996,0]; NEURAL_HAM_SHORT(-0.94)[-0.943,0]; ASN(0.00)[asn:11403, ipnet:96.47.64.0/20, country:US]; NEURAL_HAM_LONG(-1.00)[-0.999,0] X-IsSubscribed: yes X-SW-Source: 2019-02/txt/msg00154.txt.bz2 On 2/11/19 6:46 PM, Simon Marchi wrote: > On 2019-02-11 9:43 p.m., Simon Marchi wrote: >> On 2019-01-28 3:47 p.m., John Baldwin wrote: >>> child_path returns a pointer to the first component in a child path >>> that comes after a parent path. This does not depend on trying to >>> stat() the paths since they may describe remote paths but instead >>> relies on filename parsing. The function requires that the child path >>> describe a filename that contains at least one component below the >>> parent path and returns a pointer to the first component. >>> >>> gdb/ChangeLog: >>> >>> * Makefile.in (SUBDIR_UNITTESTS_SRCS): Add >>> unittests/child-path-selftests.c. >>> * common/pathstuff.c (child_path): New function. >>> * common/pathstuff.h (child_path): New prototype. >>> * unittests/child-path-selftests.c: New file. >> >> Thanks, this LGTM. Just minor comments below. > > Oh, and maybe name the function is_child_path or child_path_p? I started with that name in an earlier version when it returned a boolean, but renamed it when I found that I needed it to return the trailing portion of the child pathname to avoid duplicating logic in the caller. Maybe "get_child_path" would be better? -- John Baldwin                                                                            Â