This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH v2 2/4] Add a new function child_path.


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]