config: allow nested blocks, in case a property has a dictionary value

This commit is contained in:
George Kiagiadakis
2019-07-12 19:27:12 +03:00
parent 1b28b620c1
commit a22d353a1b

View File

@@ -100,8 +100,8 @@ parse_commands_file (struct WpDaemonData *d, GInputStream * stream,
gssize bytes_read;
gchar *cur, *linestart, *saveptr;
gchar *cmd, *abi, *module, *props;
gint lineno = 1, block_lines = 1;
gboolean eof = FALSE, in_block = FALSE;
gint lineno = 1, block_lines = 1, in_block = 0;
gboolean eof = FALSE;
GVariant *properties;
linestart = cur = buffer;
@@ -125,10 +125,10 @@ parse_commands_file (struct WpDaemonData *d, GInputStream * stream,
while (cur - buffer < bytes_read && (in_block || *cur != '\n')) {
switch (*cur) {
case '{':
in_block = TRUE;
in_block++;
break;
case '}':
in_block = FALSE;
in_block--;
break;
case '\n': // found a newline inside a block
block_lines++;