git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v4 2/4] path: optimize common dir checking

From
David Turner <dturner@twopensource.com>
Date
Aug 31, 2015, 18:56 UTC
Message-ID
<1441047399.25570.20.camel@twopensource.com>
In-Reply-To
<55E2A1BF.5080204@web.de>
On Sun, 2015-08-30 at 08:25 +0200, Torsten Bögershausen wrote:
Show 21 quoted lines
> On 26.08.15 21:46, David Turner wrote:
> > 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
> 
> 
> > +		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)

Thanks. Junio, can we squash in the following? (Or let me know and I can resend the series with both this and your patch squashed)

---
 path.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/path.c b/path.c
index 777af35..21306ab 100644
--- a/path.c
+++ b/path.c
@@ -191,7 +191,7 @@ static void *add_to_trie(struct trie *root, const
char *key, void *value)
 
 		child->len = root->len - i - 1;
 		if (child->len) {
-			child->contents = strndup(root->contents + i + 1,
+			child->contents = xstrndup(root->contents + i + 1,
 						   child->len);
 		}
 		child->value = root->value;
Previous: Torsten BögershausenNext: David Turner
Message 11 of 13 in “per-worktree bisection refs”
  1. 0/4 per-worktree bisection refsDavid Turner, Aug 26, 2015
  2. 1/4 refs: clean up common_listDavid Turner, Aug 26, 2015
  3. 2/4 path: optimize common dir checkingDavid Turner, Aug 26, 2015
  4. Junio C HamanoAug 26, 2015
  5. David TurnerAug 26, 2015
  6. Junio C HamanoAug 26, 2015
  7. David TurnerAug 26, 2015
  8. Junio C HamanoAug 28, 2015
  9. David TurnerAug 28, 2015
  10. Torsten BögershausenAug 30, 2015
  11. David TurnerAug 31, 2015
  12. 3/4 refs: make refs/worktree/* per-worktreeDavid Turner, Aug 26, 2015
  13. 4/4 bisect: make bisection refs per-worktreeDavid Turner, Aug 26, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.