git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Turner <dturner@twopensource.com>
To: "Torsten Bögershausen" <tboegi@web.de>
Cc: git@vger.kernel.org, mhagger@alum.mit.edu, pclouds@gmail.com,
	sunshine@sunshineco.com
Subject: Re: [PATCH v4 2/4] path: optimize common dir checking
Date: Mon, 31 Aug 2015 14:56:39 -0400	[thread overview]
Message-ID: <1441047399.25570.20.camel@twopensource.com> (raw)
In-Reply-To: <55E2A1BF.5080204@web.de>

On Sun, 2015-08-30 at 08:25 +0200, Torsten Bögershausen wrote:
> 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;

  reply	other threads:[~2015-08-31 18:56 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-26 19:46 [PATCH v4 0/4] per-worktree bisection refs David Turner
2015-08-26 19:46 ` [PATCH v4 1/4] refs: clean up common_list David Turner
2015-08-26 19:46 ` [PATCH v4 2/4] path: optimize common dir checking David Turner
2015-08-26 21:15   ` Junio C Hamano
2015-08-26 22:10     ` David Turner
2015-08-26 22:15       ` Junio C Hamano
2015-08-26 22:19       ` David Turner
2015-08-28 16:39         ` Junio C Hamano
2015-08-28 18:36           ` David Turner
2015-08-30  6:25   ` Torsten Bögershausen
2015-08-31 18:56     ` David Turner [this message]
2015-08-26 19:46 ` [PATCH v4 3/4] refs: make refs/worktree/* per-worktree David Turner
2015-08-26 19:46 ` [PATCH v4 4/4] bisect: make bisection refs per-worktree David Turner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1441047399.25570.20.camel@twopensource.com \
    --to=dturner@twopensource.com \
    --cc=git@vger.kernel.org \
    --cc=mhagger@alum.mit.edu \
    --cc=pclouds@gmail.com \
    --cc=sunshine@sunshineco.com \
    --cc=tboegi@web.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).