config: allow nested blocks, in case a property has a dictionary value
This commit is contained in:
@@ -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++;
|
||||||
|
Reference in New Issue
Block a user