branch: reset instead of release a strbuf
authorStefan Beller <sbeller@google.com>
Tue, 3 Oct 2017 22:17:40 +0000 (15:17 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 4 Oct 2017 06:21:31 +0000 (15:21 +0900)
commita9155c50bd52b7e27224e9588780ce5f972fa98d
tree4999bcda5bc7deb47543e53a283a08728fd77f8f
parent4010f1d1b782eb7585e0e0abcefa794bd5ff29a0
branch: reset instead of release a strbuf

Our documentation advises to not re-use a strbuf, after strbuf_release
has been called on it. Use the proper reset instead.

Currently 'strbuf_release' releases and re-initializes the strbuf, so it
is safe, but slow. 'strbuf_reset' only resets the internal length variable,
such that this could also be accounted for as a micro-optimization.

Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/branch.c