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
4
http.c
4
http.c
@ -680,8 +680,8 @@ static void curl_dump_header(const char *text, unsigned char *ptr, size_t size,
|
||||
for (header = headers; *header; header++) {
|
||||
if (hide_sensitive_header)
|
||||
redact_sensitive_header(*header);
|
||||
strbuf_insert((*header), 0, text, strlen(text));
|
||||
strbuf_insert((*header), strlen(text), ": ", 2);
|
||||
strbuf_insertstr((*header), 0, text);
|
||||
strbuf_insertstr((*header), strlen(text), ": ");
|
||||
strbuf_rtrim((*header));
|
||||
strbuf_addch((*header), '\n');
|
||||
trace_strbuf(&trace_curl, (*header));
|
||||
|
Reference in New Issue
Block a user