diff options
author | Jeff King <peff@peff.net> | 2015-08-20 10:47:34 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2015-08-20 13:16:50 -0700 |
commit | f2259877531ed2a58ec04aeaeb6beb5183f81f92 (patch) | |
tree | 94b345580485a41172af5a2dc6038ee31f36e86a /builtin/clean.c | |
parent | format_config: don't init strbuf (diff) | |
download | tgif-f2259877531ed2a58ec04aeaeb6beb5183f81f92.tar.xz |
format_config: simplify buffer handling
When formatting a config value into a strbuf, we may end
up stringifying it into a fixed-size buffer using sprintf,
and then copying that buffer into the strbuf. We can
eliminate the middle-man (and drop some calls to sprintf!)
by writing directly to the strbuf.
The reason it was written this way in the first place is
that we need to know before writing the value whether to
insert a delimiter. Instead of delaying the write of the
value, we speculatively write the delimiter, and roll it
back in the single case that cares.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/clean.c')
0 files changed, 0 insertions, 0 deletions