diff options
author | Jonathan Nieder <jrnieder@gmail.com> | 2017-10-03 19:39:54 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-10-04 15:21:52 +0900 |
commit | e0222159fa53ea24785cfb1dc5de0214e89b0117 (patch) | |
tree | 532cfcd58b57d1d7ec9f877ebbd483afd9919091 /split-index.h | |
parent | Git 2.14.2 (diff) | |
download | tgif-e0222159fa53ea24785cfb1dc5de0214e89b0117.tar.xz |
strbuf doc: reuse after strbuf_release is fine
strbuf_release leaves the strbuf in a valid, initialized state, so
there is no need to call strbuf_init after it.
Moreover, this is not likely to change in the future: strbuf_release
leaving the strbuf in a valid state has been easy to maintain and has
been very helpful for Git's robustness and simplicity (e.g.,
preventing use-after-free vulnerabilities).
Document the semantics so the next generation of Git developers can
become familiar with them without reading the implementation. It is
still not advisable to call strbuf_release too often because it is
wasteful, so add a note pointing to strbuf_reset for that.
The same semantics apply to strbuf_detach. Add a similar note to its
docstring to make that clear.
Improved-by: Jeff King <peff@peff.net>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'split-index.h')
0 files changed, 0 insertions, 0 deletions