• Duy Nguyen's avatar
    wt-status: move strbuf into read_and_strip_branch() · 8b87cfd0
    Duy Nguyen authored
    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
    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: Duy Nguyen's avatarNguyễn Thái Ngọc Duy <[email protected]>
    Signed-off-by: default avatarJunio C Hamano <[email protected]>
wt-status.h 2.16 KB