diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2018-06-01 16:20:02 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@gmail.com> | 2018-06-01 17:33:47 -0400 |
commit | f2f3de4da4d8c5d2abab5b0ba201ea7e839aa418 (patch) | |
tree | ff180a22ad63e3127370585376272c7d81921bba | |
parent | bb6f4111fbfe2550eb7b583586e732a473ba62f0 (diff) |
Delete more shim layer code
-rw-r--r-- | linux/kstrtox.c | 2 | ||||
-rw-r--r-- | linux/kstrtox.h | 1 | ||||
-rw-r--r-- | linux/vsprintf.c | 68 |
3 files changed, 9 insertions, 62 deletions
diff --git a/linux/kstrtox.c b/linux/kstrtox.c index 19372651..9164fb96 100644 --- a/linux/kstrtox.c +++ b/linux/kstrtox.c @@ -19,6 +19,8 @@ #include <linux/types.h> #include "kstrtox.h" +#define KSTRTOX_OVERFLOW (1U << 31) + const char *_parse_integer_fixup_radix(const char *s, unsigned int *base) { if (*base == 0) { diff --git a/linux/kstrtox.h b/linux/kstrtox.h index f13eeeaf..910b6de8 100644 --- a/linux/kstrtox.h +++ b/linux/kstrtox.h @@ -1,7 +1,6 @@ #ifndef _LIB_KSTRTOX_H #define _LIB_KSTRTOX_H -#define KSTRTOX_OVERFLOW (1U << 31) const char *_parse_integer_fixup_radix(const char *s, unsigned int *base); unsigned int _parse_integer(const char *s, unsigned int base, unsigned long long *res); diff --git a/linux/vsprintf.c b/linux/vsprintf.c index 3642200d..1dca320c 100644 --- a/linux/vsprintf.c +++ b/linux/vsprintf.c @@ -1,75 +1,21 @@ -#include <linux/kernel.h> -#include "kstrtox.h" +#include <stdlib.h> -/** - * simple_strtoull - convert a string to an unsigned long long - * @cp: The start of the string - * @endp: A pointer to the end of the parsed string will be placed here - * @base: The number base to use - * - * This function is obsolete. Please use kstrtoull instead. - */ unsigned long long simple_strtoull(const char *cp, char **endp, unsigned int base) { - unsigned long long result; - unsigned int rv; - - cp = _parse_integer_fixup_radix(cp, &base); - rv = _parse_integer(cp, base, &result); - /* FIXME */ - cp += (rv & ~KSTRTOX_OVERFLOW); - - if (endp) - *endp = (char *)cp; - - return result; + return strtoull(cp, endp, base); } -EXPORT_SYMBOL(simple_strtoull); -/** - * simple_strtoul - convert a string to an unsigned long - * @cp: The start of the string - * @endp: A pointer to the end of the parsed string will be placed here - * @base: The number base to use - * - * This function is obsolete. Please use kstrtoul instead. - */ unsigned long simple_strtoul(const char *cp, char **endp, unsigned int base) { - return simple_strtoull(cp, endp, base); + return strtoul(cp, endp, base); } -EXPORT_SYMBOL(simple_strtoul); -/** - * simple_strtol - convert a string to a signed long - * @cp: The start of the string - * @endp: A pointer to the end of the parsed string will be placed here - * @base: The number base to use - * - * This function is obsolete. Please use kstrtol instead. - */ -long simple_strtol(const char *cp, char **endp, unsigned int base) +long long simple_strtoll(const char *cp, char **endp, unsigned int base) { - if (*cp == '-') - return -simple_strtoul(cp + 1, endp, base); - - return simple_strtoul(cp, endp, base); + return strtoll(cp, endp, base); } -EXPORT_SYMBOL(simple_strtol); -/** - * simple_strtoll - convert a string to a signed long long - * @cp: The start of the string - * @endp: A pointer to the end of the parsed string will be placed here - * @base: The number base to use - * - * This function is obsolete. Please use kstrtoll instead. - */ -long long simple_strtoll(const char *cp, char **endp, unsigned int base) +long simple_strtol(const char *cp, char **endp, unsigned int base) { - if (*cp == '-') - return -simple_strtoull(cp + 1, endp, base); - - return simple_strtoull(cp, endp, base); + return strtol(cp, endp, base); } -EXPORT_SYMBOL(simple_strtoll); |