]> git.ipfire.org Git - thirdparty/git.git/blobdiff - strbuf.h
test-path-utils: offer to run a protectNTFS/protectHFS benchmark
[thirdparty/git.git] / strbuf.h
index 80112a8c264a02caf0ffd813557969249ddf25ac..295a6766eba766679cba25ce4889748e348e730d 100644 (file)
--- a/strbuf.h
+++ b/strbuf.h
@@ -154,7 +154,10 @@ static inline void strbuf_setlen(struct strbuf *sb, size_t len)
        if (len > (sb->alloc ? sb->alloc - 1 : 0))
                die("BUG: strbuf_setlen() beyond buffer");
        sb->len = len;
-       sb->buf[len] = '\0';
+       if (sb->buf != strbuf_slopbuf)
+               sb->buf[len] = '\0';
+       else
+               assert(!strbuf_slopbuf[0]);
 }
 
 /**