summaryrefslogtreecommitdiff
path: root/sha1_file.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2015-09-24 21:07:07 (GMT)
committerJunio C Hamano <gitster@pobox.com>2015-09-25 17:18:18 (GMT)
commit2805bb59708e1cf049445fb8b21de1a710a3a16c (patch)
tree8c30d82e7c4416ae338d0768eafa6ec3f9a4de93 /sha1_file.c
parent3ec832c4b563f3dd1f23399c3bdede1168cc77e7 (diff)
downloadgit-2805bb59708e1cf049445fb8b21de1a710a3a16c.zip
git-2805bb59708e1cf049445fb8b21de1a710a3a16c.tar.gz
git-2805bb59708e1cf049445fb8b21de1a710a3a16c.tar.bz2
fetch: replace static buffer with xstrfmt
We parse the INFINITE_DEPTH constant into a static, fixed-size buffer using sprintf. This buffer is sufficiently large for the current constant, but it's a suspicious pattern, as the constant is defined far away, and it's not immediately obvious that 12 bytes are large enough to hold it. We can just use xstrfmt here, which gets rid of any question of the buffer size. It also removes any concerns with object lifetime, which means we do not have to wonder why this buffer deep within a conditional is marked "static" (we never free our newly allocated result, of course, but that's OK; it's global that lasts the lifetime of the whole program anyway). Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'sha1_file.c')
0 files changed, 0 insertions, 0 deletions