[PATCH v2 13/19] http: simplify via strbuf_set()

From
Jeremiah Mahler <hidden>
Date
2016-06-15 23:01:33
Reply to
Jeremiah Mahler, 2016-06-15
Simplify cases where a strbuf_reset is immediately followed by a
strbuf_add by using strbuf_set operations.

Signed-off-by: Jeremiah Mahler <redacted>
---
 http.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/http.c b/http.c
index 2b4f6a3..626fed7 100644
--- a/http.c
+++ b/http.c
@@ -1098,8 +1098,7 @@ static int update_url_from_redirect(struct strbuf *base,
 	    strcmp(tail, got->buf + got->len - tail_len))
 		return 0; /* insane redirect scheme */
 
-	strbuf_reset(base);
-	strbuf_add(base, got->buf, got->len - tail_len);
+	strbuf_set(base, got->buf, got->len - tail_len);
 	return 1;
 }
 
-- 
2.0.0.592.gf55b190
Thread (28 messages) 28 messages, 3 authors, last reply 2016-06-15
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help