]> git.proxmox.com Git - mirror_qemu.git/commitdiff
qmp: Switch timestamp_put() to qdict_from_jsonf_nofail()
authorMarkus Armbruster <armbru@redhat.com>
Tue, 3 Jul 2018 08:53:54 +0000 (10:53 +0200)
committerMarkus Armbruster <armbru@redhat.com>
Tue, 3 Jul 2018 21:18:56 +0000 (23:18 +0200)
There's just one use of qobject_from_jsonf() to parse a JSON object
left: timestamp_put().  Switch it to qdict_from_jsonf_nofail().

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20180703085358.13941-29-armbru@redhat.com>

qapi/qmp-event.c

index 9d7e88e84a28e22842f07a7fa9f5d805a9b58938..5b8854043eeaa0f44035067600f3d7d93297a466 100644 (file)
@@ -34,15 +34,15 @@ QMPEventFuncEmit qmp_event_get_func_emit(void)
 static void timestamp_put(QDict *qdict)
 {
     int err;
-    QObject *obj;
+    QDict *ts;
     qemu_timeval tv;
 
     err = qemu_gettimeofday(&tv);
     /* Put -1 to indicate failure of getting host time */
-    obj = qobject_from_jsonf("{ 'seconds': %lld, 'microseconds': %lld }",
-                             err < 0 ? -1LL : (long long)tv.tv_sec,
-                             err < 0 ? -1LL : (long long)tv.tv_usec);
-    qdict_put_obj(qdict, "timestamp", obj);
+    ts = qdict_from_jsonf_nofail("{ 'seconds': %lld, 'microseconds': %lld }",
+                                 err < 0 ? -1LL : (long long)tv.tv_sec,
+                                 err < 0 ? -1LL : (long long)tv.tv_usec);
+    qdict_put(qdict, "timestamp", ts);
 }
 
 /*