From 166f76a549f570e70f0fbfaf143487ca7d649b2e Mon Sep 17 00:00:00 2001 From: Jeffy Chen Date: Wed, 15 Jun 2022 12:08:39 +0800 Subject: [PATCH 48/93] config-parser: Strip leading spaces Tested with: [core] gbm-format=argb8888 Signed-off-by: Jeffy Chen --- shared/config-parser.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/shared/config-parser.c b/shared/config-parser.c index e474963..e5195bd 100644 --- a/shared/config-parser.c +++ b/shared/config-parser.c @@ -426,13 +426,18 @@ weston_config_parse_internal(struct weston_config *config, FILE *fp, const char *file_name) { struct weston_config_section *section = NULL; - char line[512], *p; + char buf[512], *line, *p; int i; - while (fgets(line, sizeof line, fp)) { + while (fgets(buf, sizeof buf, fp)) { + line = buf; + while (isspace(*line)) + line++; + switch (line[0]) { case '#': case '\n': + case '\0': continue; case '[': p = strchr(&line[1], ']'); -- 2.20.1