Re: [PATCH v4 2/4] path: optimize common dir checking
- From
Torsten Bögershausen <tboegi@web.de>
- Date
- Aug 30, 2015, 06:25 UTC
- Message-ID
- <55E2A1BF.5080204@web.de>
- In-Reply-To
- <1440618365-20628-3-git-send-email-dturner@twopensource.com>
On 26.08.15 21:46, David Turner wrote:
Show 11 quoted lines
> Instead of a linear search over common_list to check whether > a path is common, use a trie. The trie search operates on > path prefixes, and handles excludes. > > Signed-off-by: David Turner <dturner@twopensource.com> > --- > path.c | 226 ++++++++++++++++++++++++++++++++++++++++++++++---- > t/t0060-path-utils.sh | 1 + > 2 files changed, 213 insertions(+), 14 deletions(-) > > diff --git a/path.c b/path.c
Show 5 quoted lines
> + child->len = root->len - i - 1;
> + if (child->len) {
> + child->contents = strndup(root->contents + i + 1,
> + child->len);
> }Could we use xtrndup() instead of strndup() ? (Otherwise it won't compile under Mac OS here)