[PATCH weston] shared/config-parser: Allow spaces/tabs at the end for
Marius Vlad
marius-cristian.vlad at nxp.com
Wed Feb 21 14:37:49 UTC 2018
Signed-off-by: Marius Vlad <marius-cristian.vlad at nxp.com>
---
shared/config-parser.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/shared/config-parser.c b/shared/config-parser.c
index 2a595b1..c4bb4c3 100644
--- a/shared/config-parser.c
+++ b/shared/config-parser.c
@@ -412,6 +412,7 @@ weston_config_parse(const char *name)
struct weston_config *config;
struct weston_config_section *section = NULL;
int i, fd;
+ char *start_line, *stop_line;
config = malloc(sizeof *config);
if (config == NULL)
@@ -456,6 +457,10 @@ weston_config_parse(const char *name)
section = config_add_section(config, &line[1]);
continue;
default:
+ start_line = stop_line = line;
+ while (stop_line && *stop_line != ' ' && *stop_line != '\t')
+ stop_line++;
+
p = strchr(line, '=');
if (!p || p == line || !section) {
fprintf(stderr, "malformed "
@@ -474,7 +479,9 @@ weston_config_parse(const char *name)
p[i - 1] = '\0';
i--;
}
- section_add_entry(section, line, p);
+
+ start_line[stop_line - start_line] = '\0';
+ section_add_entry(section, start_line, p);
continue;
}
}
--
2.9.3
More information about the wayland-devel
mailing list