[PATCH 12/13] qemuMonitorJSONGetStringArray: Don't return element count

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

 



There's just one caller who cares (testQemuMonitorJSONGetTPMModels). Fix
it and remove the counting of elements.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/qemu/qemu_monitor_json.c |  2 +-
 tests/qemumonitorjsontest.c  | 10 ++++------
 2 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index 74e06e7604..340d8a1027 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -7219,7 +7219,7 @@ qemuMonitorJSONGetStringArray(qemuMonitor *mon,
     if (!(*array = virJSONValueObjectGetStringArray(reply, "return")))
         return -1;

-    return g_strv_length(*array);
+    return 0;
 }

 int qemuMonitorJSONGetTPMModels(qemuMonitor *mon,
diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c
index ab589135ba..e6746b806f 100644
--- a/tests/qemumonitorjsontest.c
+++ b/tests/qemumonitorjsontest.c
@@ -561,7 +561,6 @@ testQemuMonitorJSONGetTPMModels(const void *opaque)
     const testGenericData *data = opaque;
     virDomainXMLOption *xmlopt = data->xmlopt;
     g_auto(GStrv) tpmmodels = NULL;
-    int ntpmmodels = 0;
     g_autoptr(qemuMonitorTest) test = NULL;

     if (!(test = qemuMonitorTestNewSchema(xmlopt, data->schema)))
@@ -575,13 +574,12 @@ testQemuMonitorJSONGetTPMModels(const void *opaque)
                                "}") < 0)
         return -1;

-    if ((ntpmmodels = qemuMonitorGetTPMModels(qemuMonitorTestGetMonitor(test),
-                                              &tpmmodels)) < 0)
+    if (qemuMonitorGetTPMModels(qemuMonitorTestGetMonitor(test), &tpmmodels) < 0)
         return -1;

-    if (ntpmmodels != 1) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       "ntpmmodels %d is not 1", ntpmmodels);
+    if (g_strv_length(tpmmodels) != 1) {
+        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                       "expected 1 tpm model");
         return -1;
     }

-- 
2.31.1




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux