All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] branch: reset instead of release a strbuf
@ 2017-10-03 21:14 Stefan Beller
  2017-10-03 21:46 ` Jonathan Nieder
  0 siblings, 1 reply; 9+ messages in thread
From: Stefan Beller @ 2017-10-03 21:14 UTC (permalink / raw)
  To: git; +Cc: Stefan Beller

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

Signed-off-by: Stefan Beller <sbeller@google.com>
---

Maybe one of the #leftoverbits is to remove the re-init call in release
and see what breaks? (And then fixing up more of such cases as presented
in this patch)

Thanks,
Stefan

 builtin/branch.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/builtin/branch.c b/builtin/branch.c
index b998e16d0c..9758012390 100644
--- a/builtin/branch.c
+++ b/builtin/branch.c
@@ -217,7 +217,7 @@ static int delete_branches(int argc, const char **argv, int force, int kinds,
 		if (!head_rev)
 			die(_("Couldn't look up commit object for HEAD"));
 	}
-	for (i = 0; i < argc; i++, strbuf_release(&bname)) {
+	for (i = 0; i < argc; i++, strbuf_reset(&bname)) {
 		char *target = NULL;
 		int flags = 0;
 
-- 
2.14.0.rc0.3.g6c2e499285


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2017-10-04  5:27 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-03 21:14 [PATCH] branch: reset instead of release a strbuf Stefan Beller
2017-10-03 21:46 ` Jonathan Nieder
2017-10-03 22:17   ` Stefan Beller
2017-10-03 22:24     ` Jonathan Nieder
2017-10-03 23:49       ` Jeff King
2017-10-04  2:19         ` Junio C Hamano
2017-10-04  2:39         ` [PATCH v2] strbuf doc: reuse after strbuf_release is fine Jonathan Nieder
2017-10-04  5:00           ` Junio C Hamano
2017-10-04  5:27           ` Jeff King

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.