Move print_commit_list to libgit.a
[gitweb.git] / strbuf.c
index ec88266718879ebcf89ab95b4c89f83004467869..4b9e30cadcd1ff45e7d4f23b210b22006445da91 100644 (file)
--- a/strbuf.c
+++ b/strbuf.c
@@ -44,7 +44,9 @@ void strbuf_release(struct strbuf *sb)
 
 char *strbuf_detach(struct strbuf *sb, size_t *sz)
 {
-       char *res = sb->alloc ? sb->buf : NULL;
+       char *res;
+       strbuf_grow(sb, 0);
+       res = sb->buf;
        if (sz)
                *sz = sb->len;
        strbuf_init(sb, 0);
@@ -445,8 +447,8 @@ static int is_rfc3986_unreserved(char ch)
                ch == '-' || ch == '_' || ch == '.' || ch == '~';
 }
 
-void strbuf_add_urlencode(struct strbuf *sb, const char *s, size_t len,
-                         int reserved)
+static void strbuf_add_urlencode(struct strbuf *sb, const char *s, size_t len,
+                                int reserved)
 {
        strbuf_grow(sb, len);
        while (len--) {
@@ -465,15 +467,6 @@ void strbuf_addstr_urlencode(struct strbuf *sb, const char *s,
        strbuf_add_urlencode(sb, s, strlen(s), reserved);
 }
 
-void strbuf_addf_ln(struct strbuf *sb, const char *fmt, ...)
-{
-       va_list ap;
-       va_start(ap, fmt);
-       strbuf_vaddf(sb, fmt, ap);
-       va_end(ap);
-       strbuf_addch(sb, '\n');
-}
-
 int printf_ln(const char *fmt, ...)
 {
        int ret;