From: Jeff King <peff@peff.net>
To: Karsten Blees <karsten.blees@gmail.com>
Cc: Git List <git@vger.kernel.org>, msysGit <msysgit@googlegroups.com>
Subject: Re: [PATCH 2/2] dir: remove PATH_MAX limitation
Date: Wed, 9 Jul 2014 01:42:16 -0400 [thread overview]
Message-ID: <20140709054215.GE2318@sigill.intra.peff.net> (raw)
In-Reply-To: <53B72DD5.6020603@gmail.com>
On Sat, Jul 05, 2014 at 12:42:29AM +0200, Karsten Blees wrote:
> Note: this fix just 'abuses' strbuf as string allocator, len is always 0.
> prep_exclude() can probably be simplified using more strbuf APIs.
Hrm. It looks like you grow it and add some data, but really don't want
the length to expand (because the caller depends on it).
In other directory-traversal code we follow a pattern like:
size_t prefix_len = dir->base.len;
strbuf_add(&dir->base, cp, stk->baselen - current);
/* use full path in dir->base, then "pop" */
strbuf_setlen(&dir->base, stk->baselen);
That makes it a little more obvious that the memcpy matches the
strbuf_grow (because it all happens inside strbuf_add).
Is it possible to do something like that here?
-Peff
next prev parent reply other threads:[~2014-07-09 5:42 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-04 22:41 [PATCH 1/2] symlinks: remove PATH_MAX limitation Karsten Blees
2014-07-04 22:42 ` [PATCH 2/2] dir: " Karsten Blees
2014-07-05 10:48 ` Duy Nguyen
2014-07-11 19:10 ` Karsten Blees
2014-07-09 5:42 ` Jeff King [this message]
2014-07-09 16:33 ` Junio C Hamano
2014-07-11 19:11 ` Karsten Blees
2014-07-11 22:29 ` Junio C Hamano
2014-07-11 23:43 ` Karsten Blees
2014-07-12 2:56 ` Duy Nguyen
2014-07-14 4:29 ` Junio C Hamano
2014-07-05 2:52 ` [PATCH 1/2] symlinks: " Johannes Schindelin
2014-07-07 18:30 ` Junio C Hamano
2014-07-11 19:11 ` Karsten Blees
2014-07-11 22:19 ` Junio C Hamano
2014-07-11 23:02 ` [PATCH] fixup! " Karsten Blees
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=20140709054215.GE2318@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=karsten.blees@gmail.com \
--cc=msysgit@googlegroups.com \
/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).