From bae9932b21333438930bfc8c9eeede9eab0f8a8d Mon Sep 17 00:00:00 2001
|
From: Jeffy Chen <jeffy.chen@rock-chips.com>
|
Date: Wed, 15 Jun 2022 12:08:39 +0800
|
Subject: [PATCH 71/76] config-parser: Strip leading spaces
|
|
Tested with:
|
[core]
|
gbm-format=argb8888
|
|
Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
|
---
|
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 7df5a3b..fd347ee 100644
|
--- a/shared/config-parser.c
|
+++ b/shared/config-parser.c
|
@@ -423,7 +423,7 @@ static bool
|
weston_config_parse_fd(struct weston_config *config, int fd)
|
{
|
FILE *fp;
|
- char line[512], *p;
|
+ char buf[512], *line, *p;
|
struct stat filestat;
|
struct weston_config_section *section = NULL;
|
int i;
|
@@ -441,10 +441,15 @@ weston_config_parse_fd(struct weston_config *config, int fd)
|
if (fp == NULL)
|
return false;
|
|
- 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
|