mirror of
https://github.com/torvalds/linux.git
synced 2026-09-22 04:34:03 +02:00
lib: kstrtox: Make _parse_integer() take variadic arguments
Instead of having different functions that just use default parameters, combine those to use variadic arguments, so the user may call it using the same name. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Petr Mladek <pmladek@suse.com> Signed-off-by: Rodrigo Alencar <rodrigo.alencar@analog.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
This commit is contained in:
parent
0d294bcb76
commit
ce0d638054
|
|
@ -94,12 +94,6 @@ unsigned int _parse_integer_limit(const char *s, unsigned int base, unsigned lon
|
|||
return rv | overflow;
|
||||
}
|
||||
|
||||
noinline
|
||||
unsigned int _parse_integer(const char *s, unsigned int base, unsigned long long *p)
|
||||
{
|
||||
return _parse_integer_limit(s, base, p, INT_MAX);
|
||||
}
|
||||
|
||||
static int _kstrtoull(const char *s, unsigned int base, unsigned long long *res)
|
||||
{
|
||||
unsigned long long _res;
|
||||
|
|
|
|||
|
|
@ -2,10 +2,17 @@
|
|||
#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 int _parse_integer(const char *s, unsigned int base, unsigned long long *res);
|
||||
|
||||
#define _parse_integer0(s, base, res, ...) \
|
||||
_parse_integer_limit(s, base, res, INT_MAX)
|
||||
|
||||
#define _parse_integer(s, base, res, ...) \
|
||||
CONCATENATE(_parse_integer, COUNT_ARGS(__VA_ARGS__))(s, base, res, __VA_ARGS__)
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user