diff options
author | Eric Blake <eblake@redhat.com> | 2017-04-27 16:58:17 -0500 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2017-05-09 09:13:51 +0200 |
commit | 46f5ac205a9dc5e2c24274c7df371509a286281f (patch) | |
tree | 52cd3eab32f34963a5275f6f291386d4ad8b6624 /monitor.c | |
parent | a92c21591b5bb9543996538f14854ca6b528318b (diff) |
qobject: Use simpler QDict/QList scalar insertion macros
We now have macros in place to make it less verbose to add a scalar
to QDict and QList, so use them.
Patch created mechanically via:
spatch --sp-file scripts/coccinelle/qobject.cocci \
--macro-file scripts/cocci-macro-file.h --dir . --in-place
then touched up manually to fix a couple of '?:' back to original
spacing, as well as avoiding a long line in monitor.c.
Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20170427215821.19397-7-eblake@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Diffstat (limited to 'monitor.c')
-rw-r--r-- | monitor.c | 23 |
1 files changed, 11 insertions, 12 deletions
@@ -2769,7 +2769,7 @@ static QDict *monitor_parse_arguments(Monitor *mon, } goto fail; } - qdict_put(qdict, key, qstring_from_str(buf)); + qdict_put_str(qdict, key, buf); } break; case 'O': @@ -2871,9 +2871,9 @@ static QDict *monitor_parse_arguments(Monitor *mon, size = -1; } } - qdict_put(qdict, "count", qint_from_int(count)); - qdict_put(qdict, "format", qint_from_int(format)); - qdict_put(qdict, "size", qint_from_int(size)); + qdict_put_int(qdict, "count", count); + qdict_put_int(qdict, "format", format); + qdict_put_int(qdict, "size", size); } break; case 'i': @@ -2916,7 +2916,7 @@ static QDict *monitor_parse_arguments(Monitor *mon, } val <<= 20; } - qdict_put(qdict, key, qint_from_int(val)); + qdict_put_int(qdict, key, val); } break; case 'o': @@ -2939,7 +2939,7 @@ static QDict *monitor_parse_arguments(Monitor *mon, monitor_printf(mon, "invalid size\n"); goto fail; } - qdict_put(qdict, key, qint_from_int(val)); + qdict_put_int(qdict, key, val); p = end; } break; @@ -2995,7 +2995,7 @@ static QDict *monitor_parse_arguments(Monitor *mon, monitor_printf(mon, "Expected 'on' or 'off'\n"); goto fail; } - qdict_put(qdict, key, qbool_from_bool(val)); + qdict_put_bool(qdict, key, val); } break; case '-': @@ -3026,7 +3026,7 @@ static QDict *monitor_parse_arguments(Monitor *mon, } else { /* has option */ p++; - qdict_put(qdict, key, qbool_from_bool(true)); + qdict_put_bool(qdict, key, true); } } } @@ -3052,7 +3052,7 @@ static QDict *monitor_parse_arguments(Monitor *mon, cmd->name); goto fail; } - qdict_put(qdict, key, qstring_from_str(p)); + qdict_put_str(qdict, key, p); p += len; } break; @@ -3831,9 +3831,8 @@ static void handle_qmp_command(JSONMessageParser *parser, GQueue *tokens) QapiErrorClass_lookup[ERROR_CLASS_COMMAND_NOT_FOUND])) { /* Provide a more useful error message */ qdict_del(qdict, "desc"); - qdict_put(qdict, "desc", - qstring_from_str("Expecting capabilities negotiation" - " with 'qmp_capabilities'")); + qdict_put_str(qdict, "desc", "Expecting capabilities negotiation" + " with 'qmp_capabilities'"); } } |