As argued elsewhere, it's less code to maintain if we convert from a dynamic string passed to qobject_from_jsonv() to instead use hand-built QDict.
Signed-off-by: Eric Blake <ebl...@redhat.com> --- Optional; the "%s" handling in earlier patches is sufficient to handle this without hand-built QDict, so it is a judgment call which version is more legible. --- tests/test-x86-cpuid-compat.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/tests/test-x86-cpuid-compat.c b/tests/test-x86-cpuid-compat.c index 79a2e69..bce5c8a 100644 --- a/tests/test-x86-cpuid-compat.c +++ b/tests/test-x86-cpuid-compat.c @@ -4,6 +4,7 @@ #include "qapi/qmp/qdict.h" #include "qapi/qmp/qint.h" #include "qapi/qmp/qbool.h" +#include "qapi/qmp/qstring.h" #include "libqtest.h" static char *get_cpu0_qom_path(void) @@ -25,11 +26,14 @@ static char *get_cpu0_qom_path(void) static QObject *qom_get(const char *path, const char *prop) { - QDict *resp = qmp("{ 'execute': 'qom-get'," - " 'arguments': { 'path': %s," - " 'property': %s } }", - path, prop); - QObject *ret = qdict_get(resp, "return"); + QDict *args = qdict_new(); + QDict *resp; + QObject *ret; + + qdict_put_str(args, "path", path); + qdict_put_str(args, "property", prop); + resp = qmp_cmd("qom-get", args); + ret = qdict_get(resp, "return"); qobject_incref(ret); QDECREF(resp); return ret; -- 2.7.4