diff --git a/strbuf.c b/strbuf.c
index 60e5e598dd4e49e8b2fd37b0bbb5040639b4411d..ff0b96b4162bd92162a7eb05eee5be7a5ec2b6ba 100644 (file)
--- a/strbuf.c
+++ b/strbuf.c
return len;
}
return len;
}
+void strbuf_add_lines(struct strbuf *out, const char *prefix,
+ const char *buf, size_t size)
+{
+ while (size) {
+ const char *next = memchr(buf, '\n', size);
+ next = next ? (next + 1) : (buf + size);
+ strbuf_addstr(out, prefix);
+ strbuf_add(out, buf, next - buf);
+ size -= next - buf;
+ buf = next;
+ }
+ strbuf_complete_line(out);
+}
+
static int is_rfc3986_reserved(char ch)
{
switch (ch) {
static int is_rfc3986_reserved(char ch)
{
switch (ch) {