Brandon Casey <drafnel@xxxxxxxxx> writes: > So is there any reason why didn't do something like the following in > the first place? My guess is that we didn't bother; if we cared, we would have used a single instance of const char in a read-only segment, instead of such a macro. > diff --git a/strbuf.h b/strbuf.h > index e705b94..fcca618 100644 > --- a/strbuf.h > +++ b/strbuf.h > @@ -67,7 +67,7 @@ struct strbuf { > char *buf; > }; > > -extern char strbuf_slopbuf[]; > +#define strbuf_slopbuf "" > #define STRBUF_INIT { .alloc = 0, .len = 0, .buf = strbuf_slopbuf } > > /** > @@ -147,7 +147,9 @@ 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->alloc) { > + sb->buf[len] = '\0'; > + } > } > > -Brandon