Re: [PATCH 1/3] tree.c: update read_tree_recursive callback to pass strbuf as base

3 messages, 3 authors, 2016-06-15 · open the first message on its own page

Re: [PATCH 1/3] tree.c: update read_tree_recursive callback to pass strbuf as base

From: Junio C Hamano <hidden>
Date: 2016-06-15 23:03:09

Nguyễn Thái Ngọc Duy  [off-list ref] 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?

Re: [PATCH 1/3] tree.c: update read_tree_recursive callback to pass strbuf as base

From: Duy Nguyen <hidden>
Date: 2016-06-15 23:03:10

On Tue, Dec 2, 2014 at 2:32 AM, Junio C Hamano [off-list ref] wrote:
Nguyễn Thái Ngọc Duy  [off-list ref] writes:
quoted
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.
-- 
Duy

Re: [PATCH 1/3] tree.c: update read_tree_recursive callback to pass strbuf as base

From: Eric Sunshine <hidden>
Date: 2016-06-15 23:03:10

On Tue, Dec 2, 2014 at 7:11 AM, Duy Nguyen [off-list ref] wrote:
On Tue, Dec 2, 2014 at 2:32 AM, Junio C Hamano [off-list ref] wrote:
quoted
Nguyễn Thái Ngọc Duy  [off-list ref] writes:
quoted
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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help