diff options
author | Michael Brown | 2015-02-19 17:00:01 +0100 |
---|---|---|
committer | Michael Brown | 2015-02-19 17:00:01 +0100 |
commit | a32b1e9e3557393d60fb4805cd74d8ba357b66cb (patch) | |
tree | acd24bea0b4b0fc300d9b2d613dab573ca49b21f /src/core/base16.c | |
parent | [ipv4] Rewrite inet_aton() (diff) | |
download | ipxe-a32b1e9e3557393d60fb4805cd74d8ba357b66cb.tar.gz ipxe-a32b1e9e3557393d60fb4805cd74d8ba357b66cb.tar.xz ipxe-a32b1e9e3557393d60fb4805cd74d8ba357b66cb.zip |
[libc] Rewrite strtoul()
The implementation of strtoul() has a partially unknown provenance.
Rewrite this code to avoid potential licensing uncertainty.
Since we now use -ffunction-sections, there is no need to place
strtoull() in a separate file from strtoul().
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/core/base16.c')
-rw-r--r-- | src/core/base16.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/core/base16.c b/src/core/base16.c index bf9cc21b..d2977bde 100644 --- a/src/core/base16.c +++ b/src/core/base16.c @@ -20,9 +20,10 @@ FILE_LICENCE ( GPL2_OR_LATER ); #include <stdint.h> -#include <stdlib.h> #include <stdio.h> #include <errno.h> +#include <assert.h> +#include <ipxe/string.h> #include <ipxe/base16.h> /** @file @@ -87,13 +88,13 @@ int hex_decode ( const char *encoded, char separator, void *data, size_t len ) { /* Extract digits. Note that either digit may be NUL, * which would be interpreted as an invalid value by - * strtoul_charval(); there is therefore no need for an + * digit_value(); there is therefore no need for an * explicit end-of-string check. */ - sixteens = strtoul_charval ( *(encoded++) ); + sixteens = digit_value ( *(encoded++) ); if ( sixteens >= 16 ) return -EINVAL; - units = strtoul_charval ( *(encoded++) ); + units = digit_value ( *(encoded++) ); if ( units >= 16 ) return -EINVAL; |