Add strbuf_vaddf(), use it in strbuf_addf(), and add strbuf_initf()
commitbbb4b8f4496d178d0729c32fd224d4192a0b4ebc
authorJohannes Schindelin <johannes.schindelin@gmx.de>
Thu, 6 Mar 2008 00:37:16 +0000 (6 01:37 +0100)
committerJohannes Schindelin <johannes.schindelin@gmx.de>
Sun, 7 Feb 2010 21:17:35 +0000 (7 22:17 +0100)
tree01dec03e40e48b8fe76352f5fba4bdb22e88df6e
parent586f59d95e691b2410968d0440b7bb6f5460e849
Add strbuf_vaddf(), use it in strbuf_addf(), and add strbuf_initf()

The most common use of addf() was to init a strbuf and addf() right away.
Since it is so common, it makes sense to have a function strbuf_initf() to
wrap both calls into one.

To do that, we implement a (really minimal) vaddf() lookalike to
vsprintf().

At the moment, it only handles %u, %i, %d, %l, %o, %x and %X with size
indicators '<number>', ' <number>' and '0<number>', as well as %c and %s,
the latter with size indicators '.*' and '-*' in addition to the same size
indicators as for numbers.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
.gitignore
Makefile
strbuf.c
strbuf.h
t/t0000-basic.sh
test-strbuf.c [new file with mode: 0644]