Merge branch 'rw/apply-does-not-take-ignore-date'
[gitweb.git] / utf8.c
diff --git a/utf8.c b/utf8.c
index 3b77e9765811b2dc0b7c4031b1229d432e1942d2..9a3f4ad23293bf6a3fc06a1942fd324fa1b74ded 100644 (file)
--- a/utf8.c
+++ b/utf8.c
@@ -239,13 +239,6 @@ int is_utf8(const char *text)
        return 1;
 }
 
-static void strbuf_addchars(struct strbuf *sb, int c, size_t n)
-{
-       strbuf_grow(sb, n);
-       memset(sb->buf + sb->len, c, n);
-       strbuf_setlen(sb, sb->len + n);
-}
-
 static void strbuf_add_indented_text(struct strbuf *buf, const char *text,
                                     int indent, int indent2)
 {
@@ -382,6 +375,9 @@ void strbuf_utf8_replace(struct strbuf *sb_src, int pos, int width,
                        dst += n;
                }
 
+               if (src >= end)
+                       break;
+
                old = src;
                n = utf8_width((const char**)&src, NULL);
                if (!src)       /* broken utf-8, do nothing */