lib/fit: Normalize spaces in board names to dashes

CONFIG_MAINBOARD_PART_NUMBER sometimes contains spaces, but spaces
inside compat strings aren't nice, so let's convert all spaces to
dashes.

Change-Id: I46f2b2d7091782e04df5476e50698001511f664b
Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
Reviewed-on: https://review.coreboot.org/c/30173
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Julius Werner <jwerner@chromium.org>
This commit is contained in:
Jonathan Neuschäfer 2018-12-12 01:12:13 +01:00 committed by Patrick Georgi
parent dca74c16a3
commit bbaae959bd
1 changed files with 2 additions and 2 deletions

View File

@ -38,12 +38,12 @@ struct compat_string_entry {
struct list_node list_node;
};
/* Convert string to lowercase and replace '_' with '-'. */
/* Convert string to lowercase and replace '_' and spaces with '-'. */
static char *clean_compat_string(char *str)
{
for (size_t i = 0; i < strlen(str); i++) {
str[i] = tolower(str[i]);
if (str[i] == '_')
if (str[i] == '_' || str[i] == ' ')
str[i] = '-';
}