[PATCH v3+ 1/5] wt-status: move strbuf into read_and_strip_branch()

2013-03-15 Thread Nguyễn Thái Ngọc Duy
The strbufs are placed outside read_and_strip_branch as a premature optimization: when it reads refs/heads/foo to strbuf and wants to return just foo, it could do so without memory movement. In return the caller must not use the returned pointer after releasing strbufs, which own the buffers that

[PATCH v3 1/5] wt-status: move strbuf into read_and_strip_branch()

2013-03-13 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy pclo...@gmail.com --- wt-status.c | 65 - wt-status.h | 4 ++-- 2 files changed, 32 insertions(+), 37 deletions(-) diff --git a/wt-status.c b/wt-status.c index ef405d0..6cac27b 100644 ---

Re: [PATCH v3 1/5] wt-status: move strbuf into read_and_strip_branch()

2013-03-13 Thread Junio C Hamano
Nguyễn Thái Ngọc Duy pclo...@gmail.com writes: Signed-off-by: Nguyễn Thái Ngọc Duy pclo...@gmail.com You do not have anything to say above the S-o-b line? The primary effect of this patch is to change the lifespan and ownership rule of the piece of memory used for state.branch/state.onto and