From 31471ba21ee29886ab856981e52f723c913d7f40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Scharfe?= Date: Thu, 21 Jul 2016 18:46:44 +0200 Subject: strbuf: avoid calling strbuf_grow() twice in strbuf_addbuf() Implement strbuf_addbuf() as a normal function in order to avoid calling strbuf_grow() twice, with the second callinside strbud_add() being a no-op. This is slightly faster and also reduces the text size a bit. Signed-off-by: Rene Scharfe Signed-off-by: Junio C Hamano --- strbuf.h | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'strbuf.h') diff --git a/strbuf.h b/strbuf.h index 5397d91d7a..45d25d7c4b 100644 --- a/strbuf.h +++ b/strbuf.h @@ -263,11 +263,7 @@ static inline void strbuf_addstr(struct strbuf *sb, const char *s) /** * Copy the contents of another buffer at the end of the current one. */ -static inline void strbuf_addbuf(struct strbuf *sb, const struct strbuf *sb2) -{ - strbuf_grow(sb, sb2->len); - strbuf_add(sb, sb2->buf, sb2->len); -} +extern void strbuf_addbuf(struct strbuf *sb, const struct strbuf *sb2); /** * Copy part of the buffer from a given position till a given length to the -- cgit v1.2.1