Received: from eggs.gnu.org ([2001:4830:134:3::10]:35442) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cCAoh-0003oG-HF for qemu-devel@nongnu.org; Wed, 30 Nov 2016 14:45:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cCAog-0001sP-LQ for qemu-devel@nongnu.org; Wed, 30 Nov 2016 14:45:19 -0500 Received: from mx1.redhat.com ([209.132.183.28]:59436) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cCAog-0001rc-GL for qemu-devel@nongnu.org; Wed, 30 Nov 2016 14:45:18 -0500 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7D8988AE65 for ; Wed, 30 Nov 2016 19:45:17 +0000 (UTC) From: Eric Blake Date: Wed, 30 Nov 2016 13:44:28 -0600 Message-Id: <1480535094-23831-11-git-send-email-eblake@redhat.com> In-Reply-To: <1480535094-23831-1-git-send-email-eblake@redhat.com> References: <1480535094-23831-1-git-send-email-eblake@redhat.com> Subject: [Qemu-devel] [PATCH 10/36] qtest: Avoid dynamic JSON in libqtest List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: armbru@redhat.com, pbonzini@redhat.com The qobject_from_jsonf() function implements a pseudo-printf language for creating a QObject through the extension of dynamic JSON; however, it is hard-coded to only parse a subset of formats understood by -Wformat and is not a straight synonym to bare printf(). During a recent cleanup due to problems caused by PRId64, it was questioned whether the maintenance burden of keeping the dynamic JSON extension can be counterbalanced by converting code to use alternative ways of describing QObject. The only use of dynamic JSON in the testsuite glue code was the creation of a human monitor command over QMP, and is a relatively straightforward update. Signed-off-by: Eric Blake --- tests/libqtest.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/libqtest.c b/tests/libqtest.c index 0796bb0..26c4beb 100644 --- a/tests/libqtest.c +++ b/tests/libqtest.c @@ -580,11 +580,11 @@ char *qtest_hmpv(QTestState *s, const char *fmt, va_list ap) char *cmd; QDict *resp; char *ret; + QDict *args = qdict_new(); cmd = g_strdup_vprintf(fmt, ap); - resp = qtest_qmp(s, "{'execute': 'human-monitor-command'," - " 'arguments': {'command-line': %s}}", - cmd); + qdict_put_str(args, "command-line", cmd); + resp = qtest_qmp_cmd(s, "human-monitor-command", args); ret = g_strdup(qdict_get_try_str(resp, "return")); g_assert(ret); QDECREF(resp); -- 2.7.4