diff options
author | Simon Glass <sjg@chromium.org> | 2021-07-24 09:03:30 -0600 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2021-08-02 13:32:14 -0400 |
commit | 0b1284eb52578e15ec611adc5fee1a9ae68dadea (patch) | |
tree | 2d83815e93fc16decbaa5671fd660ade0ec74532 /lib/strto.c | |
parent | 7e5f460ec457fe310156e399198a41eb0ce1e98c (diff) |
global: Convert simple_strtoul() with decimal to dectoul()
It is a pain to have to specify the value 10 in each call. Add a new
dectoul() function and update the code to use it.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'lib/strto.c')
-rw-r--r-- | lib/strto.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/strto.c b/lib/strto.c index 57d62163da..72903a57c0 100644 --- a/lib/strto.c +++ b/lib/strto.c @@ -54,6 +54,11 @@ ulong hextoul(const char *cp, char **endp) return simple_strtoul(cp, endp, 16); } +ulong dectoul(const char *cp, char **endp) +{ + return simple_strtoul(cp, endp, 10); +} + int strict_strtoul(const char *cp, unsigned int base, unsigned long *res) { char *tail; @@ -164,7 +169,7 @@ long trailing_strtoln(const char *str, const char *end) if (isdigit(end[-1])) { for (p = end - 1; p > str; p--) { if (!isdigit(*p)) - return simple_strtoul(p + 1, NULL, 10); + return dectoul(p + 1, NULL); } } |