mirror of
https://github.com/brl/mutter.git
synced 2024-12-24 12:02:04 +00:00
json: Update JsonParser
Add another fix from upstream, to clean up the code.
This commit is contained in:
parent
295bc517f8
commit
66e0f18753
@ -512,22 +512,20 @@ json_parse_array (JsonParser *parser,
|
||||
}
|
||||
|
||||
token = g_scanner_get_next_token (scanner);
|
||||
if (token == G_TOKEN_RIGHT_BRACE)
|
||||
break;
|
||||
|
||||
if (token == G_TOKEN_COMMA)
|
||||
{
|
||||
token = g_scanner_get_next_token (scanner);
|
||||
if (token == G_TOKEN_RIGHT_BRACE)
|
||||
return G_TOKEN_SYMBOL;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
else if (token != G_TOKEN_RIGHT_BRACE)
|
||||
{
|
||||
json_array_unref (array);
|
||||
|
||||
return G_TOKEN_RIGHT_BRACE;
|
||||
}
|
||||
}
|
||||
|
||||
json_node_take_array (priv->current_node, array);
|
||||
|
||||
@ -590,6 +588,7 @@ json_parse_object (JsonParser *parser,
|
||||
return G_TOKEN_STRING;
|
||||
}
|
||||
|
||||
/* nested object */
|
||||
if (token == G_TOKEN_LEFT_CURLY)
|
||||
{
|
||||
JsonNode *old_node = priv->current_node;
|
||||
@ -640,6 +639,7 @@ json_parse_object (JsonParser *parser,
|
||||
return G_TOKEN_RIGHT_CURLY;
|
||||
}
|
||||
|
||||
/* nested array */
|
||||
if (token == G_TOKEN_LEFT_BRACE)
|
||||
{
|
||||
JsonNode *old_node = priv->current_node;
|
||||
@ -752,22 +752,20 @@ json_parse_object (JsonParser *parser,
|
||||
g_free (name);
|
||||
|
||||
token = g_scanner_get_next_token (scanner);
|
||||
if (token == G_TOKEN_RIGHT_CURLY)
|
||||
break;
|
||||
|
||||
if (token == G_TOKEN_COMMA)
|
||||
{
|
||||
token = g_scanner_get_next_token (scanner);
|
||||
if (token == G_TOKEN_RIGHT_CURLY)
|
||||
return G_TOKEN_SYMBOL;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
else if (token != G_TOKEN_RIGHT_CURLY)
|
||||
{
|
||||
json_object_unref (object);
|
||||
|
||||
return G_TOKEN_RIGHT_CURLY;
|
||||
}
|
||||
}
|
||||
|
||||
json_node_take_object (priv->current_node, object);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user