qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 19/36] qtest: Change qmp_discard_response() to drop


From: Eric Blake
Subject: [Qemu-devel] [PATCH 19/36] qtest: Change qmp_discard_response() to drop varargs
Date: Wed, 30 Nov 2016 13:44:37 -0600

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 <address@hidden>
---
 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)
-- 
2.7.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]