From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 84698 invoked by alias); 12 Feb 2019 16:56:22 -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 84687 invoked by uid 89); 12 Feb 2019 16:56:22 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: simark.ca Received: from simark.ca (HELO simark.ca) (158.69.221.121) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 12 Feb 2019 16:56:21 +0000 Received: by simark.ca (Postfix, from userid 112) id 5EE901E64E; Tue, 12 Feb 2019 11:56:19 -0500 (EST) Received: from simark.ca (localhost [127.0.0.1]) by simark.ca (Postfix) with ESMTP id A02C71E16B; Tue, 12 Feb 2019 11:56:18 -0500 (EST) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Tue, 12 Feb 2019 16:56:00 -0000 From: Simon Marchi To: John Baldwin Cc: gdb-patches@sourceware.org Subject: Re: [PATCH v2 2/4] Add a new function child_path. In-Reply-To: <19c13b48-63d4-581e-76f4-96b7dd3cd158@FreeBSD.org> References: <19c13b48-63d4-581e-76f4-96b7dd3cd158@FreeBSD.org> Message-ID: <5ebc5be144593f836cc2a06b021be35d@simark.ca> X-Sender: simark@simark.ca User-Agent: Roundcube Webmail/1.3.6 X-SW-Source: 2019-02/txt/msg00156.txt.bz2 On 2019-02-12 11:52, John Baldwin wrote: > 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? Ah you're right, it doesn't make sense if the function doesn't return a bool. What you have is fine with me. Simon