Re: [PATCH v15 02/12] lib: kstrtox: add local _parse_integer_limit_init() helper

From: Andy Shevchenko

Date: Tue Jun 02 2026 - 15:43:24 EST


On Sun, May 31, 2026 at 09:30:45AM +0100, Rodrigo Alencar via B4 Relay wrote:

> Add parsing helper that accepts an initial value for the accumulated
> result when parsing an 64-bit integer. It reuses current implementation
> for _parse_integer_limit(), which now consumes the new function with
> init = 0. The diff algorithm would have the documentation header and
> prototype of _parse_integer_limit() moved around so it is adjusted
> according to guidelines.

...

> +static unsigned int _parse_integer_limit_init(const char *s, unsigned int base,
> + unsigned long long init,

Why not name it res...

> + unsigned long long *p,
> + size_t max_chars)
> {
> unsigned long long res;

...and drop this one...

> unsigned int rv;
>
> - res = 0;
> + res = init;

...and this one?

--
With Best Regards,
Andy Shevchenko