From: Junio C Hamano Date: Tue, 31 Jul 2007 04:36:47 GMT Subject: Re: [PATCH 3/5] Add strbuf_printf() to do formatted printing to a strbuf. Message-ID: <7vhcnlgpeo.fsf@assigned-by-dhcp.cox.net> In-Reply-To: <11858309322006-git-send-email-krh@redhat.com> Kristian Høgsberg writes: > +static void inline strbuf_grow(struct strbuf *sb, size_t extra) > +{ > + while (sb->alloc < sb->len + extra) > sb->alloc = sb->alloc * 3 / 2 + 16; > + sb->buf = xrealloc(sb->buf, sb->alloc); > +} Somehow this while () loop to compute the growth factor bothers me but that is probably a minor detail. > +void strbuf_printf(struct strbuf *sb, const char *fmt, ...) > +{ > + char one_line[2048]; > + va_list args; > + int len; Such a nice abstraction so far, and then at the highest level of callchain we have this hardcoded limit?