summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 8a3c63e)
raw | patch | inline | side by side (parent: 8a3c63e)
author | René Scharfe <rene.scharfe@lsrfire.ath.cx> | |
Fri, 19 Feb 2010 22:15:01 +0000 (23:15 +0100) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sat, 20 Feb 2010 17:18:04 +0000 (09:18 -0800) |
strbuf_add_wrapped_text() is called only from print_wrapped_text()
without a strbuf (in which case it writes its results to stdout).
At its only callsite, supply a strbuf, call strbuf_add_wrapped_text()
directly and remove the wrapper function.
Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
without a strbuf (in which case it writes its results to stdout).
At its only callsite, supply a strbuf, call strbuf_add_wrapped_text()
directly and remove the wrapper function.
Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-shortlog.c | patch | blob | history | |
utf8.c | patch | blob | history | |
utf8.h | patch | blob | history |
diff --git a/builtin-shortlog.c b/builtin-shortlog.c
index 8aa63c7857fb3a704826bf223ddefb3e40f0eaf7..d96858f9adcf185e65d6028634bd981430a0f193 100644 (file)
--- a/builtin-shortlog.c
+++ b/builtin-shortlog.c
return 0;
}
+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');
+}
+
void shortlog_output(struct shortlog *log)
{
int i, j;
+ struct strbuf sb = STRBUF_INIT;
+
if (log->sort_by_number)
qsort(log->list.items, log->list.nr, sizeof(struct string_list_item),
compare_by_number);
const char *msg = onelines->items[j].string;
if (log->wrap_lines) {
- int col = print_wrapped_text(msg, log->in1, log->in2, log->wrap);
- if (col != log->wrap)
- putchar('\n');
+ strbuf_reset(&sb);
+ add_wrapped_shortlog_msg(&sb, msg, log);
+ fwrite(sb.buf, sb.len, 1, stdout);
}
else
printf(" %s\n", msg);
log->list.items[i].util = NULL;
}
+ strbuf_release(&sb);
log->list.strdup_strings = 1;
string_list_clear(&log->list, 1);
clear_mailmap(&log->mailmap);
index 7ddff23fa77fbadf7723bca03d24ad5b8f2baca2..5c8a2697f3cceacaa3dff2ea1c7ff9379e280285 100644 (file)
--- a/utf8.c
+++ b/utf8.c
}
}
-int print_wrapped_text(const char *text, int indent, int indent2, int width)
-{
- return strbuf_add_wrapped_text(NULL, text, indent, indent2, width);
-}
-
int is_encoding_utf8(const char *name)
{
if (!name)
index ae30ae4c6e501e4766db93c94253fd404cd29357..b09687d500b89d4f3a0644fea8b1eff420e0748a 100644 (file)
--- a/utf8.h
+++ b/utf8.h
int is_utf8(const char *text);
int is_encoding_utf8(const char *name);
-int print_wrapped_text(const char *text, int indent, int indent2, int len);
int strbuf_add_wrapped_text(struct strbuf *buf,
const char *text, int indent, int indent2, int width);