From patchwork Wed Nov 30 19:44:37 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Blake X-Patchwork-Id: 9454807 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E8D0C60585 for ; Wed, 30 Nov 2016 20:09:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DBC9B2849F for ; Wed, 30 Nov 2016 20:09:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CF252284A2; Wed, 30 Nov 2016 20:09:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 7F5C02849F for ; Wed, 30 Nov 2016 20:09:03 +0000 (UTC) Received: from localhost ([::1]:46180 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cCBBe-00060L-Le for patchwork-qemu-devel@patchwork.kernel.org; Wed, 30 Nov 2016 15:09:02 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35593) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cCAoo-0003uT-H9 for qemu-devel@nongnu.org; Wed, 30 Nov 2016 14:45:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cCAon-0001x6-7c for qemu-devel@nongnu.org; Wed, 30 Nov 2016 14:45:26 -0500 Received: from mx1.redhat.com ([209.132.183.28]:37704) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cCAom-0001wV-Tw for qemu-devel@nongnu.org; Wed, 30 Nov 2016 14:45:25 -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 0F3B37DD06 for ; Wed, 30 Nov 2016 19:45:24 +0000 (UTC) Received: from red.redhat.com (ovpn-116-172.phx2.redhat.com [10.3.116.172]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id uAUJj2nQ025934; Wed, 30 Nov 2016 14:45:23 -0500 From: Eric Blake To: qemu-devel@nongnu.org Date: Wed, 30 Nov 2016 13:44:37 -0600 Message-Id: <1480535094-23831-20-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> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Wed, 30 Nov 2016 19:45:24 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 19/36] qtest: Change qmp_discard_response() to drop varargs X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: pbonzini@redhat.com, armbru@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Now that no more clients are passing variadic arguments, we can update the contract to state that we will be using normal JSON parsing rather than dynamic JSON for any client using this wrapper. Signed-off-by: Eric Blake --- tests/libqtest.h | 18 ++++-------------- tests/libqtest.c | 22 +++++----------------- 2 files changed, 9 insertions(+), 31 deletions(-) diff --git a/tests/libqtest.h b/tests/libqtest.h index 07ddaa2..c89c075 100644 --- a/tests/libqtest.h +++ b/tests/libqtest.h @@ -42,11 +42,11 @@ void qtest_quit(QTestState *s); /** * qtest_qmp_discard_response: * @s: #QTestState instance to operate on. - * @fmt...: QMP message to send to qemu + * @json: QMP message to send to qemu * * Sends a QMP message to QEMU and consumes the response. */ -void qtest_qmp_discard_response(QTestState *s, const char *fmt, ...); +void qtest_qmp_discard_response(QTestState *s, const char *json); /** * qtest_qmp: @@ -78,16 +78,6 @@ QDict *qtest_qmp_cmd(QTestState *s, const char *cmd, QDict *args); void qtest_async_qmp(QTestState *s, const char *fmt, ...); /** - * qtest_qmpv_discard_response: - * @s: #QTestState instance to operate on. - * @fmt: QMP message to send to QEMU - * @ap: QMP message arguments - * - * Sends a QMP message to QEMU and consumes the response. - */ -void qtest_qmpv_discard_response(QTestState *s, const char *fmt, va_list ap); - -/** * qtest_qmpv: * @s: #QTestState instance to operate on. * @fmt: QMP message to send to QEMU @@ -562,11 +552,11 @@ void qmp_async(const char *fmt, ...); /** * qmp_discard_response: - * @fmt...: QMP message to send to qemu + * @json: QMP message to send to qemu * * Sends a QMP message to QEMU and consumes the response. */ -void qmp_discard_response(const char *fmt, ...); +void qmp_discard_response(const char *json); /** * qmp_cmd_discard_response: diff --git a/tests/libqtest.c b/tests/libqtest.c index 26c4beb..1328bd9 100644 --- a/tests/libqtest.c +++ b/tests/libqtest.c @@ -536,20 +536,12 @@ void qtest_async_qmp(QTestState *s, const char *fmt, ...) va_end(ap); } -void qtest_qmpv_discard_response(QTestState *s, const char *fmt, va_list ap) +void qtest_qmp_discard_response(QTestState *s, const char *json) { - QDict *response = qtest_qmpv(s, fmt, ap); - QDECREF(response); -} - -void qtest_qmp_discard_response(QTestState *s, const char *fmt, ...) -{ - va_list ap; QDict *response; - va_start(ap, fmt); - response = qtest_qmpv(s, fmt, ap); - va_end(ap); + assert(!strchr(json, '%')); + response = qtest_qmp(s, json); QDECREF(response); } @@ -920,13 +912,9 @@ void qmp_async(const char *fmt, ...) va_end(ap); } -void qmp_discard_response(const char *fmt, ...) +void qmp_discard_response(const char *json) { - va_list ap; - - va_start(ap, fmt); - qtest_qmpv_discard_response(global_qtest, fmt, ap); - va_end(ap); + qtest_qmp_discard_response(global_qtest, json); } void qmp_cmd_discard_response(const char *cmd, QDict *args)