Move the removal of leading whitespace from values read from the configuration file to the code that reads them from the config file. This allows more sharing of string related functions.
Signed-off-by: Roy Franz roy.franz@linaro.org --- xen/arch/x86/efi/boot.c | 2 -- xen/arch/x86/efi/efi-shared.c | 8 +++++++- 2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/xen/arch/x86/efi/boot.c b/xen/arch/x86/efi/boot.c index 2e3d341..045714b 100644 --- a/xen/arch/x86/efi/boot.c +++ b/xen/arch/x86/efi/boot.c @@ -176,8 +176,6 @@ void __init load_file(EFI_FILE_HANDLE dir_handle, CHAR16 *name,
static void __init split_value(char *s) { - while ( *s && isspace(*s) ) - ++s; place_string(&mb_modules[mbi.mods_count].string, s); while ( *s && !isspace(*s) ) ++s; diff --git a/xen/arch/x86/efi/efi-shared.c b/xen/arch/x86/efi/efi-shared.c index 98ad5db..0a67363 100644 --- a/xen/arch/x86/efi/efi-shared.c +++ b/xen/arch/x86/efi/efi-shared.c @@ -337,7 +337,13 @@ char *__init get_value(const struct file *cfg, const char *section, break; default: if ( match && strncmp(ptr, item, ilen) == 0 && ptr[ilen] == '=' ) - return ptr + ilen + 1; + { + ptr += ilen + 1; + /* strip off any leading spaces */ + while ( *ptr && isspace(*ptr) ) + ptr++; + return ptr; + } break; } ptr += strlen(ptr);