config: factor out integer parsing from range checks
commit7192777d226c5b8653c65112a309c2ebd3d6d5c5
authorJeff King <peff@peff.net>
Sun, 8 Sep 2013 08:29:27 +0000 (8 04:29 -0400)
committerJunio C Hamano <gitster@pobox.com>
Mon, 9 Sep 2013 18:04:28 +0000 (9 11:04 -0700)
tree82c4f56d785f743d59e50f449a10390a91f7c5b7
parent4d06473928ee574910accbde05c19ef2263abdf6
config: factor out integer parsing from range checks

When we are parsing integers for config, we use an intmax_t
(or uintmax_t) internally, and then check against the size
of our result type at the end. We can parameterize the
maximum representable value, which will let us re-use the
parsing code for a variety of range checks.

Unfortunately, we cannot combine the signed and unsigned
parsing functions easily, as we have to rely on the signed
and unsigned C types internally.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
config.c