diff options
author | Simon Glass <sjg@chromium.org> | 2021-07-24 18:03:30 +0300 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2021-08-02 20:32:14 +0300 |
commit | 0b1284eb52578e15ec611adc5fee1a9ae68dadea (patch) | |
tree | 2d83815e93fc16decbaa5671fd660ade0ec74532 /include | |
parent | 7e5f460ec457fe310156e399198a41eb0ce1e98c (diff) | |
download | u-boot-0b1284eb52578e15ec611adc5fee1a9ae68dadea.tar.xz |
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 'include')
-rw-r--r-- | include/vsprintf.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/include/vsprintf.h b/include/vsprintf.h index 5a268ab5cb..c30e91fd6f 100644 --- a/include/vsprintf.h +++ b/include/vsprintf.h @@ -38,6 +38,19 @@ ulong simple_strtoul(const char *cp, char **endp, unsigned int base); unsigned long hextoul(const char *cp, char **endp); /** + * dec_strtoul - convert a string in decimal to an unsigned long + * + * @param cp The string to be converted + * @param endp Updated to point to the first character not converted + * @return value decoded from string (0 if invalid) + * + * Converts a decimal string to an unsigned long. If there are invalid + * characters at the end these are ignored. In the worst case, if all characters + * are invalid, 0 is returned + */ +unsigned long dectoul(const char *cp, char **endp); + +/** * strict_strtoul - convert a string to an unsigned long strictly * @param cp The string to be converted * @param base The number base to use |