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

Signed-off-by: Jeremiah Mahler <jmmah...@gmail.com>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to