summaryrefslogtreecommitdiff
path: root/qobject/json-streamer.c
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2015-11-25 22:23:26 +0100
committerMarkus Armbruster <armbru@redhat.com>2015-11-26 09:22:54 +0100
commitc54616608af442edf4cfb7397a1909c2653efba0 (patch)
tree6a84404cf40ffad47caed8f12b36b80fc905ff1e /qobject/json-streamer.c
parentb8d3b1da3cdbb02e180618d6be346c564723015d (diff)
qjson: Give each of the six structural chars its own token type
Simplifies things, because we always check for a specific one. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <1448486613-17634-6-git-send-email-armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'qobject/json-streamer.c')
-rw-r--r--qobject/json-streamer.c32
1 files changed, 15 insertions, 17 deletions
diff --git a/qobject/json-streamer.c b/qobject/json-streamer.c
index 2bd22a738e..4a161a17a1 100644
--- a/qobject/json-streamer.c
+++ b/qobject/json-streamer.c
@@ -26,23 +26,21 @@ static void json_message_process_token(JSONLexer *lexer, QString *token, JSONTok
JSONMessageParser *parser = container_of(lexer, JSONMessageParser, lexer);
QDict *dict;
- if (type == JSON_OPERATOR) {
- switch (qstring_get_str(token)[0]) {
- case '{':
- parser->brace_count++;
- break;
- case '}':
- parser->brace_count--;
- break;
- case '[':
- parser->bracket_count++;
- break;
- case ']':
- parser->bracket_count--;
- break;
- default:
- break;
- }
+ switch (type) {
+ case JSON_LCURLY:
+ parser->brace_count++;
+ break;
+ case JSON_RCURLY:
+ parser->brace_count--;
+ break;
+ case JSON_LSQUARE:
+ parser->bracket_count++;
+ break;
+ case JSON_RSQUARE:
+ parser->bracket_count--;
+ break;
+ default:
+ break;
}
dict = qdict_new();