Add generic purpose number parsing function to be used by modeline parsing.
Signed-off-by: Joonas Lahtinen <[email protected]> Reviewed-by: Darren Hart <[email protected]> Reviewed-by: Mikko Ylinen <[email protected]> --- src/efi/gummiboot.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/efi/gummiboot.c b/src/efi/gummiboot.c index 127db22..8a83474 100644 --- a/src/efi/gummiboot.c +++ b/src/efi/gummiboot.c @@ -1356,6 +1356,32 @@ static CHAR8 *strchra(CHAR8 *s, CHAR8 c) { return NULL; } +static INTN atoi(CHAR16 *str) +{ + INTN i; + BOOLEAN sign = FALSE; + CHAR16 c; + + while (*str && *str == ' ') { + str += 1; + } + + if(*str == '-') { + sign = TRUE; + str += 1; + } + + i = 0; + while (c = *(str++)) { + if (c >= '0' && c <= '9') { + i = (i * 10) + (c - '0'); + } else { + break; + } + } + return sign ? -i : i; +} + static CHAR8 *line_get_key_value(CHAR8 *content, UINTN *pos, CHAR8 **key_ret, CHAR8 **value_ret) { CHAR8 *line; UINTN linelen; -- 1.8.1.4 _______________________________________________ systemd-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/systemd-devel
