mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
synced 2026-10-28 12:53:14 +01:00
Add init parameter to _parse_integer_limit() that defines an initial value for the accumulated result when parsing an 64-bit integer. The new function prototype is adjusted so that the _parse_integer() macros stay consistent allowing for one more argument, which defaults to 0. Signed-off-by: Rodrigo Alencar <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
25 lines
833 B
C
25 lines
833 B
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef _LIB_KSTRTOX_H
|
|
#define _LIB_KSTRTOX_H
|
|
|
|
#include <linux/args.h>
|
|
|
|
#define KSTRTOX_OVERFLOW (1U << 31)
|
|
const char *_parse_integer_fixup_radix(const char *s, unsigned int *base);
|
|
unsigned int _parse_integer_limit(const char *s, unsigned int base, unsigned long long *res,
|
|
size_t max_chars, unsigned long long init);
|
|
|
|
#define _parse_integer0(s, base, res, ...) \
|
|
_parse_integer_limit(s, base, res, INT_MAX, 0)
|
|
|
|
#define _parse_integer1(s, base, res, max_chars, ...) \
|
|
_parse_integer_limit(s, base, res, max_chars, 0)
|
|
|
|
#define _parse_integer2(s, base, res, max_chars, init, ...) \
|
|
_parse_integer_limit(s, base, res, max_chars, init)
|
|
|
|
#define _parse_integer(s, base, res, ...) \
|
|
CONCATENATE(_parse_integer, COUNT_ARGS(__VA_ARGS__))(s, base, res, __VA_ARGS__)
|
|
|
|
#endif
|