MCPcopy Index your code
hub / github.com/git/git / add_lines

Function add_lines

strbuf.c:374–391  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

372}
373
374static void add_lines(struct strbuf *out,
375 const char *prefix,
376 const char *buf, size_t size,
377 int space_after_prefix)
378{
379 while (size) {
380 const char *next = memchr(buf, '\n', size);
381 next = next ? (next + 1) : (buf + size);
382
383 strbuf_addstr(out, prefix);
384 if (space_after_prefix && buf[0] != '\n' && buf[0] != '\t')
385 strbuf_addch(out, ' ');
386 strbuf_add(out, buf, next - buf);
387 size -= next - buf;
388 buf = next;
389 }
390 strbuf_complete_line(out);
391}
392
393void strbuf_add_commented_lines(struct strbuf *out, const char *buf,
394 size_t size, const char *comment_prefix)

Callers 2

strbuf_add_linesFunction · 0.85

Calls 4

strbuf_addstrFunction · 0.85
strbuf_addchFunction · 0.85
strbuf_addFunction · 0.85
strbuf_complete_lineFunction · 0.85

Tested by

no test coverage detected