summaryrefslogtreecommitdiff
path: root/wt-status.h
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2013-03-16 09:12:36 +0700
committerJunio C Hamano <gitster@pobox.com>2013-03-16 22:10:32 -0700
commit8b87cfd000c7c98f58279cff698f6e8c7892c059 (patch)
tree377bf80b612912dca6462e9b10ec06f7dd0a2651 /wt-status.h
parentcdd76db373c23bbd637c76a605b3e7f571500103 (diff)
downloadgit-8b87cfd000c7c98f58279cff698f6e8c7892c059.tar.gz
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 'wt-status.h')
-rw-r--r--wt-status.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/wt-status.h b/wt-status.h
index 81e1dcf84d..b8c3512903 100644
--- a/wt-status.h
+++ b/wt-status.h
@@ -79,8 +79,8 @@ struct wt_status_state {
int rebase_interactive_in_progress;
int cherry_pick_in_progress;
int bisect_in_progress;
- const char *branch;
- const char *onto;
+ char *branch;
+ char *onto;
};
void wt_status_prepare(struct wt_status *s);