diff options
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2013-03-16 09:12:36 +0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-03-16 22:10:32 -0700 |
commit | 8b87cfd000c7c98f58279cff698f6e8c7892c059 (patch) | |
tree | 377bf80b612912dca6462e9b10ec06f7dd0a2651 /sh-i18n--envsubst.c | |
parent | Merge branch 'jc/reflog-reverse-walk' into nd/branch-show-rebase-bisect-state (diff) | |
download | tgif-8b87cfd000c7c98f58279cff698f6e8c7892c059.tar.xz |
wt-status: move strbuf into read_and_strip_branch()
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 contain the returned strings. It's a clumsy
design.
By moving strbufs into read_and_strip_branch(), the returned pointer
always points to a malloc'd buffer or NULL. The pointer can be passed
around and freed after use.
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'sh-i18n--envsubst.c')
0 files changed, 0 insertions, 0 deletions