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