Thread (28 messages) 28 messages, 3 authors, 2016-06-15

[PATCH v2 19/19] wt-status: simplify via strbuf_set()

flat view
STALE3773d

From: Jeremiah Mahler <hidden>
Date: 2016-06-15 23:01:33
Subsystem: the rest · Maintainer: Linus Torvalds

Simplify cases where a strbuf_reset is immediately followed by a
strbuf_add by using strbuf_set operations.

Signed-off-by: Jeremiah Mahler <redacted>
---
 wt-status.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/wt-status.c b/wt-status.c
index 318a191..a89cd73 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -1168,8 +1168,7 @@ static char *read_and_strip_branch(const char *path)
 	else if (!get_sha1_hex(sb.buf, sha1)) {
 		const char *abbrev;
 		abbrev = find_unique_abbrev(sha1, DEFAULT_ABBREV);
-		strbuf_reset(&sb);
-		strbuf_addstr(&sb, abbrev);
+		strbuf_setstr(&sb, abbrev);
 	} else if (!strcmp(sb.buf, "detached HEAD")) /* rebase */
 		goto got_nothing;
 	else			/* bisect */
-- 
2.0.0.592.gf55b190
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help