@matheusbsbs / matheus-bagliano / commits / 68ad5e1e9c
Fork 0

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>

René Scharfe committed Feb 19, 2010 at 23:16 UTC 68ad5e1e9c10e8a640703aadbdf8b8366014373b
1 file changed +5 -13
utf8.c
+5 -13
@@ -280,14 +280,6 @@ int is_utf8(const char *text)
280 return 1;
281 }
282
283 -static inline void strbuf_write(struct strbuf *sb, const char *buf, int len)
284 -{
285 - if (sb)
286 - strbuf_insert(sb, sb->len, buf, len);
287 - else
288 - fwrite(buf, len, 1, stdout);
289 -}
290 -
283 static void strbuf_addchars(struct strbuf *sb, int c, size_t n)
284 {
285 strbuf_grow(sb, n);
@@ -305,7 +297,7 @@ static void strbuf_add_indented_text(struct strbuf *buf, const char *text,
297 if (*eol == '\n')
298 eol++;
299 strbuf_addchars(buf, ' ', indent);
308 - strbuf_write(buf, text, eol - text);
300 + strbuf_add(buf, text, eol - text);
301 text = eol;
302 indent = indent2;
303 }
@@ -364,7 +356,7 @@ int strbuf_add_wrapped_text(struct strbuf *buf,
356 start = space;
357 else
358 strbuf_addchars(buf, ' ', indent);
367 - strbuf_write(buf, start, text - start);
359 + strbuf_add(buf, start, text - start);
360 if (!c)
361 return w;
362 space = text;
@@ -373,20 +365,20 @@ int strbuf_add_wrapped_text(struct strbuf *buf,
365 else if (c == '\n') {
366 space++;
367 if (*space == '\n') {
376 - strbuf_write(buf, "\n", 1);
368 + strbuf_addch(buf, '\n');
369 goto new_line;
370 }
371 else if (!isalnum(*space))
372 goto new_line;
373 else
382 - strbuf_write(buf, " ", 1);
374 + strbuf_addch(buf, ' ');
375 }
376 w++;
377 text++;
378 }
379 else {
380 new_line:
389 - strbuf_write(buf, "\n", 1);
381 + strbuf_addch(buf, '\n');
382 text = bol = space + isspace(*space);
383 space = NULL;
384 w = indent = indent2;