Re: [PATCH GSoC v18 10/13] transport: add client support for object-info
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jul 15, 2026, 17:22 UTC
- Message-ID
- <xmqqpl0onp5d.fsf@gitster.g>
- In-Reply-To
- <20260715-ps-eric-work-rebase-v18-10-34d7adb051bb@gmail.com>
Pablo Sabater <pabloosabaterr@gmail.com> writes:
Show 13 quoted lines
> +static size_t parse_object_size(const char *s, size_t *res)
> +{
> + uintmax_t uim;
> +
> + if (!s[0] || s[strspn(s, "0123456789")])
> + return -1;
> + errno = 0;
> + uim = strtoumax(s, NULL, 10);
> + if (errno || uim > SIZE_MAX)
> + return -1;
> + *res = uim;
> + return 0;
> +}Since size_t is unsigned, returning -1 is a bit problematic, isn't it? Perhaps this should return a plain 'int' instead.
The sole caller only cares about a boolean "did we succeed or fail?" result, and more importantly, the actual size parsed is already returned via the out-parameter.
Thanks.