strbuf: add and use strbuf_insertstr()
Add a function for inserting a C string into a strbuf. Use it throughout the source to get rid of magic string length constants and explicit strlen() calls. Like strbuf_addstr(), implement it as an inline function to avoid the implicit strlen() calls to cause runtime overhead. Helped-by: Taylor Blau <me@ttaylorr.com> Helped-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: René Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
d0654dc308
commit
a91cc7fad0
2
commit.c
2
commit.c
@ -993,7 +993,7 @@ static int do_sign_commit(struct strbuf *buf, const char *keyid)
|
||||
strbuf_insert(buf, inspos, gpg_sig_header, gpg_sig_header_len);
|
||||
inspos += gpg_sig_header_len;
|
||||
}
|
||||
strbuf_insert(buf, inspos++, " ", 1);
|
||||
strbuf_insertstr(buf, inspos++, " ");
|
||||
strbuf_insert(buf, inspos, bol, len);
|
||||
inspos += len;
|
||||
copypos += len;
|
||||
|
Reference in New Issue
Block a user