From: Eric Sunshine <sunshine@sunshineco.com>
To: Duy Nguyen <pclouds@gmail.com>
Cc: Junio C Hamano <gitster@pobox.com>,
Git Mailing List <git@vger.kernel.org>
Subject: Re: [PATCH 1/3] tree.c: update read_tree_recursive callback to pass strbuf as base
Date: Tue, 2 Dec 2014 19:11:44 -0500 [thread overview]
Message-ID: <CAPig+cS1OK6pv5A0vuJf=j6eFrNv70=AYgVz3zQny-md15_xKg@mail.gmail.com> (raw)
In-Reply-To: <CACsJy8B7G9xQerZ+6GTPQuG2v1DuJLXfsKFobuz_vyFahnXuYQ@mail.gmail.com>
On Tue, Dec 2, 2014 at 7:11 AM, Duy Nguyen <pclouds@gmail.com> wrote:
> On Tue, Dec 2, 2014 at 2:32 AM, Junio C Hamano <gitster@pobox.com> wrote:
>> Nguyễn Thái Ngọc Duy <pclouds@gmail.com> writes:
>>
>>> This allows the callback to use 'base' as a temporary buffer to
>>> quickly assemble full path "without" extra allocation. The callback
>>> has to restore it afterwards of course.
>>
>> Hmph, what's the quote around 'without' doing there?
>
> because it's only true if you haven't used up all preallocated space
> in strbuf. If someone passes an empty strbuf, then underneath strbuf
> may do a few realloc until the buffer is large enough.
Would it be easier to understand if written like this?
This allows the callback to use 'base' as a temporary buffer to
quickly assemble full path, thus avoiding allocation/deallocation
for each iteration step.
next prev parent reply other threads:[~2014-12-03 0:11 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-30 9:04 [PATCH 0/3] ls-tree fixes Nguyễn Thái Ngọc Duy
2014-11-30 9:05 ` [PATCH 1/3] tree.c: update read_tree_recursive callback to pass strbuf as base Nguyễn Thái Ngọc Duy
2014-12-01 19:32 ` Junio C Hamano
2014-12-02 12:11 ` Duy Nguyen
2014-12-03 0:11 ` Eric Sunshine [this message]
2014-12-03 16:13 ` Junio C Hamano
2014-12-08 13:30 ` Duy Nguyen
2014-11-30 9:05 ` [PATCH 2/3] ls-tree: remove path filtering logic in show_tree Nguyễn Thái Ngọc Duy
2014-11-30 9:05 ` [PATCH 3/3] ls-tree: disable negative pathspec because it's not supported Nguyễn Thái Ngọc Duy
2014-12-01 19:40 ` Junio C Hamano
2014-12-02 12:14 ` Duy Nguyen
-- strict thread matches above, loose matches on Subject: below --
2014-11-08 11:00 [PATCH 1/3] tree.c: update read_tree_recursive callback to pass strbuf as base Nguyễn Thái Ngọc Duy
2014-11-08 11:03 ` Duy Nguyen
2014-11-09 3:56 ` Eric Sunshine
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='CAPig+cS1OK6pv5A0vuJf=j6eFrNv70=AYgVz3zQny-md15_xKg@mail.gmail.com' \
--to=sunshine@sunshineco.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=pclouds@gmail.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).