diff options
author | Erik Schmauss <erik.schmauss@intel.com> | 2018-08-11 00:42:57 +0300 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2018-08-15 00:49:13 +0300 |
commit | 089b2bec97bbddb519e849a58b1ba8cc9880a4e5 (patch) | |
tree | 2f8cb134358d9026463769373a70884f561ecbd5 /drivers/acpi/acpica/utstrsuppt.c | |
parent | 8a55c696d327008b003957d828ff04b81ead5dd1 (diff) | |
download | linux-089b2bec97bbddb519e849a58b1ba8cc9880a4e5.tar.xz |
ACPICA: Utilities: split hex detection into smaller functions
acpi_ut_implicit_strtoul64() called acpi_ut_detect_hex_prefix() and
ignored the return value. Instead, use acpi_ut_remove_hex_prefix().
Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/acpi/acpica/utstrsuppt.c')
-rw-r--r-- | drivers/acpi/acpica/utstrsuppt.c | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/drivers/acpi/acpica/utstrsuppt.c b/drivers/acpi/acpica/utstrsuppt.c index 954f8e3e35cd..05ff20049b87 100644 --- a/drivers/acpi/acpica/utstrsuppt.c +++ b/drivers/acpi/acpica/utstrsuppt.c @@ -231,14 +231,34 @@ char acpi_ut_remove_whitespace(char **string) u8 acpi_ut_detect_hex_prefix(char **string) { + char *initial_position = *string; + acpi_ut_remove_hex_prefix(string); + if (*string != initial_position) { + return (TRUE); /* String is past leading 0x */ + } + + return (FALSE); /* Not a hex string */ +} + +/******************************************************************************* + * + * FUNCTION: acpi_ut_remove_hex_prefix + * + * PARAMETERS: string - Pointer to input ASCII string + * + * RETURN: none + * + * DESCRIPTION: Remove a hex "0x" prefix + * + ******************************************************************************/ + +void acpi_ut_remove_hex_prefix(char **string) +{ if ((**string == ACPI_ASCII_ZERO) && (tolower((int)*(*string + 1)) == 'x')) { *string += 2; /* Go past the leading 0x */ - return (TRUE); } - - return (FALSE); /* Not a hex string */ } /******************************************************************************* |