From: Johannes Sixt Date: Thu, 24 Aug 2017 20:29:22 GMT Subject: Re: [Patch size_t V3 11/19] Use size_t for config parsing Message-ID: <0a045197-199a-b1bc-f0bb-9ecf96ad2b50@kdbg.org> In-Reply-To: <1502914591-26215-12-git-send-email-martin@mail.zuhause> Am 16.08.2017 um 22:16 schrieb Martin Koegler: > +int git_parse_size_t(const char *value, size_t *ret) > +{ > + uintmax_t tmp; > + if (!git_parse_unsigned(value, &tmp, maximum_signed_value_of_type(size_t))) > + return 0; > + *ret = tmp; > + return 1; > +} > + I think this requires the following on top: diff --git a/config.c b/config.c index 81d46602f9..b3075aa1c4 100644 --- a/config.c +++ b/config.c @@ -866,7 +866,7 @@ static int git_parse_ssize_t(const char *value, ssize_t *ret) int git_parse_size_t(const char *value, size_t *ret) { uintmax_t tmp; - if (!git_parse_unsigned(value, &tmp, maximum_signed_value_of_type(size_t))) + if (!git_parse_unsigned(value, &tmp, maximum_unsigned_value_of_type(size_t))) return 0; *ret = tmp; return 1;