Move the shared string-processing helper to efi_app_common: * skip_whitespace() - advance past leading whitespace
Remove the now-duplicate static definition from dtbdump, initrddump, smbiosdump and dbginfodump. Signed-off-by: Heinrich Schuchardt <[email protected]> --- v2: new patch --- lib/efi_loader/dbginfodump.c | 13 ------------- lib/efi_loader/dtbdump.c | 13 ------------- lib/efi_loader/efi_app_common.c | 7 +++++++ lib/efi_loader/efi_app_common.h | 8 ++++++++ lib/efi_loader/initrddump.c | 13 ------------- lib/efi_loader/smbiosdump.c | 13 ------------- 6 files changed, 15 insertions(+), 52 deletions(-) diff --git a/lib/efi_loader/dbginfodump.c b/lib/efi_loader/dbginfodump.c index 8fa60a7f48e..4808fe254fe 100644 --- a/lib/efi_loader/dbginfodump.c +++ b/lib/efi_loader/dbginfodump.c @@ -82,19 +82,6 @@ static void printp(void *p) print(str); } -/** - * skip_whitespace() - skip over leading whitespace - * - * @pos: UTF-16 string - * Return: pointer to first non-whitespace - */ -static u16 *skip_whitespace(u16 *pos) -{ - for (; *pos && *pos <= 0x20; ++pos) - ; - return pos; -} - /** * do_help() - print help */ diff --git a/lib/efi_loader/dtbdump.c b/lib/efi_loader/dtbdump.c index 716daf4a90f..559c64be7f7 100644 --- a/lib/efi_loader/dtbdump.c +++ b/lib/efi_loader/dtbdump.c @@ -87,19 +87,6 @@ static void *get_dtb(struct efi_system_table *systable) return dtb; } -/** - * skip_whitespace() - skip over leading whitespace - * - * @pos: UTF-16 string - * Return: pointer to first non-whitespace - */ -static u16 *skip_whitespace(u16 *pos) -{ - for (; *pos && *pos <= 0x20; ++pos) - ; - return pos; -} - /** * do_help() - print help */ diff --git a/lib/efi_loader/efi_app_common.c b/lib/efi_loader/efi_app_common.c index 406cd236f6f..6bd52e08d28 100644 --- a/lib/efi_loader/efi_app_common.c +++ b/lib/efi_loader/efi_app_common.c @@ -96,6 +96,13 @@ void error(u16 *string) color(EFI_LIGHTBLUE); } +u16 *skip_whitespace(u16 *pos) +{ + for (; *pos && *pos <= 0x20; ++pos) + ; + return pos; +} + bool starts_with(u16 *string, u16 *keyword) { if (!string) diff --git a/lib/efi_loader/efi_app_common.h b/lib/efi_loader/efi_app_common.h index 4498607ef07..ff37f3413eb 100644 --- a/lib/efi_loader/efi_app_common.h +++ b/lib/efi_loader/efi_app_common.h @@ -55,6 +55,14 @@ void cls(void); */ void error(u16 *string); +/** + * skip_whitespace() - skip over leading whitespace + * + * @pos: UTF-16 string + * Return: pointer to first non-whitespace + */ +u16 *skip_whitespace(u16 *pos); + /** * starts_with() - check if string starts with keyword * diff --git a/lib/efi_loader/initrddump.c b/lib/efi_loader/initrddump.c index 52562be048d..0a025c1a841 100644 --- a/lib/efi_loader/initrddump.c +++ b/lib/efi_loader/initrddump.c @@ -45,19 +45,6 @@ static const struct efi_lo_dp_prefix initrd_dp = { } }; -/** - * skip_whitespace() - skip over leading whitespace - * - * @pos: UTF-16 string - * Return: pointer to first non-whitespace - */ -static u16 *skip_whitespace(u16 *pos) -{ - for (; *pos && *pos <= 0x20; ++pos) - ; - return pos; -} - /** * do_help() - print help */ diff --git a/lib/efi_loader/smbiosdump.c b/lib/efi_loader/smbiosdump.c index 100e03294e5..351e103fb97 100644 --- a/lib/efi_loader/smbiosdump.c +++ b/lib/efi_loader/smbiosdump.c @@ -25,19 +25,6 @@ static const efi_guid_t guid_simple_file_system_protocol = EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID; static const efi_guid_t efi_system_partition_guid = PARTITION_SYSTEM_GUID; -/** - * skip_whitespace() - skip over leading whitespace - * - * @pos: UTF-16 string - * Return: pointer to first non-whitespace - */ -static u16 *skip_whitespace(u16 *pos) -{ - for (; *pos && *pos <= 0x20; ++pos) - ; - return pos; -} - /** * open_file_system() - open simple file system protocol * -- 2.53.0

