]> git.ipfire.org Git - thirdparty/git.git/blobdiff - strbuf.c
strbuf: accept a comment string for strbuf_commented_addf()
[thirdparty/git.git] / strbuf.c
index e9b6127e766d4cef9d868b1c6d90b705d5abea8c..76d02e0920a8c91c2d8c18eb41a32e0d26186b4d 100644 (file)
--- a/strbuf.c
+++ b/strbuf.c
@@ -368,7 +368,7 @@ void strbuf_add_commented_lines(struct strbuf *out, const char *buf,
        add_lines(out, prefix, buf, size, 1);
 }
 
-void strbuf_commented_addf(struct strbuf *sb, char comment_prefix,
+void strbuf_commented_addf(struct strbuf *sb, const char *comment_prefix,
                           const char *fmt, ...)
 {
        va_list params;
@@ -379,7 +379,13 @@ void strbuf_commented_addf(struct strbuf *sb, char comment_prefix,
        strbuf_vaddf(&buf, fmt, params);
        va_end(params);
 
-       strbuf_add_commented_lines(sb, buf.buf, buf.len, comment_prefix);
+       /*
+        * TODO Our commented_lines helper does not yet understand
+        * comment strings. But since we know that the strings are
+        * always single-char, we can cheat for the moment, and
+        * fix this later.
+        */
+       strbuf_add_commented_lines(sb, buf.buf, buf.len, comment_prefix[0]);
        if (incomplete_line)
                sb->buf[--sb->len] = '\0';