summaryrefslogtreecommitdiff
path: root/utf8.c
diff options
context:
space:
mode:
authorRené Scharfe <rene.scharfe@lsrfire.ath.cx>2010-02-19 23:16:45 +0100
committerJunio C Hamano <gitster@pobox.com>2010-02-20 09:19:35 -0800
commit68ad5e1e9c10e8a640703aadbdf8b8366014373b (patch)
treed139339b006dbba92abff29f68c86a79673a3b69 /utf8.c
parent3c0ff44a1ee92bd0f811b95d747a08763983566b (diff)
downloadgit-68ad5e1e9c10e8a640703aadbdf8b8366014373b.tar.gz
utf8.c: remove strbuf_write()
The patch before the previous one made sure that all callers of strbuf_add_wrapped_text() supply a strbuf. Replace all calls of strbuf_write() with regular strbuf functions and remove it. Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'utf8.c')
-rw-r--r--utf8.c18
1 files changed, 5 insertions, 13 deletions
diff --git a/utf8.c b/utf8.c
index a4e36ff33c..9f64f59d66 100644
--- a/utf8.c
+++ b/utf8.c
@@ -280,14 +280,6 @@ int is_utf8(const char *text)
return 1;
}
-static inline void strbuf_write(struct strbuf *sb, const char *buf, int len)
-{
- if (sb)
- strbuf_insert(sb, sb->len, buf, len);
- else
- fwrite(buf, len, 1, stdout);
-}
-
static void strbuf_addchars(struct strbuf *sb, int c, size_t n)
{
strbuf_grow(sb, n);
@@ -305,7 +297,7 @@ static void strbuf_add_indented_text(struct strbuf *buf, const char *text,
if (*eol == '\n')
eol++;
strbuf_addchars(buf, ' ', indent);
- strbuf_write(buf, text, eol - text);
+ strbuf_add(buf, text, eol - text);
text = eol;
indent = indent2;
}
@@ -364,7 +356,7 @@ int strbuf_add_wrapped_text(struct strbuf *buf,
start = space;
else
strbuf_addchars(buf, ' ', indent);
- strbuf_write(buf, start, text - start);
+ strbuf_add(buf, start, text - start);
if (!c)
return w;
space = text;
@@ -373,20 +365,20 @@ int strbuf_add_wrapped_text(struct strbuf *buf,
else if (c == '\n') {
space++;
if (*space == '\n') {
- strbuf_write(buf, "\n", 1);
+ strbuf_addch(buf, '\n');
goto new_line;
}
else if (!isalnum(*space))
goto new_line;
else
- strbuf_write(buf, " ", 1);
+ strbuf_addch(buf, ' ');
}
w++;
text++;
}
else {
new_line:
- strbuf_write(buf, "\n", 1);
+ strbuf_addch(buf, '\n');
text = bol = space + isspace(*space);
space = NULL;
w = indent = indent2;