void strbuf_add_wrapped_bytes(struct strbuf *buf, const char *data, int len, int indent, int indent2, int width) { char *tmp = xstrndup(data, len); strbuf_add_wrapped_text(buf, tmp, indent, indent2, width); free(tmp); }
static void add_wrapped_shortlog_msg(struct strbuf *sb, const char *s, const struct shortlog *log) { int col = strbuf_add_wrapped_text(sb, s, log->in1, log->in2, log->wrap); if (col != log->wrap) strbuf_addch(sb, '\n'); }
static void strbuf_wrap(struct strbuf *sb, size_t pos, size_t width, size_t indent1, size_t indent2) { struct strbuf tmp = STRBUF_INIT; if (pos) strbuf_add(&tmp, sb->buf, pos); strbuf_add_wrapped_text(&tmp, sb->buf + pos, (int) indent1, (int) indent2, (int) width); strbuf_swap(&tmp, sb); strbuf_release(&tmp); }
int print_wrapped_text(const char *text, int indent, int indent2, int width) { return strbuf_add_wrapped_text(NULL, text, indent, indent2, width); }