author | René Scharfe <rene.scharfe@lsrfire.ath.cx> | |
Tue, 6 Jan 2009 20:41:14 +0000 (21:41 +0100) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Wed, 7 Jan 2009 06:13:43 +0000 (22:13 -0800) | ||
commit | 2fc647004ac7016128372a85db8245581e493812 | |
tree | 90e0830cc8d31a8ba144857dfcd22e392c2a65d4 | tree | snapshot |
parent | 2d642a6f8a5d17db21a60865f8970b9231d34e31 | commit | diff |
strbuf: instate cleanup rule in case of non-memory errors
Make all strbuf functions that can fail free() their memory on error if
they have allocated it. They don't shrink buffers that have been grown,
though.
This allows for easier error handling, as callers only need to call
strbuf_release() if A) the command succeeded or B) if they would have had
to do so anyway because they added something to the strbuf themselves.
Bonus hunk: document strbuf_readlink.
Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Make all strbuf functions that can fail free() their memory on error if
they have allocated it. They don't shrink buffers that have been grown,
though.
This allows for easier error handling, as callers only need to call
strbuf_release() if A) the command succeeded or B) if they would have had
to do so anyway because they added something to the strbuf themselves.
Bonus hunk: document strbuf_readlink.
Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/technical/api-strbuf.txt | diff | blob | history | |
strbuf.c | diff | blob | history |