[PATCH 10/14] qemu: Merge qemuMonitorJSONGetCPUData in qemuMonitorJSONGetGuestCPU

Jiri Denemark via Devel posted 14 patches 3 days, 13 hours ago
[PATCH 10/14] qemu: Merge qemuMonitorJSONGetCPUData in qemuMonitorJSONGetGuestCPU
Posted by Jiri Denemark via Devel 3 days, 13 hours ago
From: Jiri Denemark <jdenemar@redhat.com>

The qemuMonitorJSONGetCPUData function is just a wrapper around two
function calls and it is only used by qemuMonitorJSONGetGuestCPU.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
---
 src/qemu/qemu_monitor_json.c | 27 ++++++---------------------
 1 file changed, 6 insertions(+), 21 deletions(-)

diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index a831e9e26c..6fa2f447db 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -6724,25 +6724,6 @@ qemuMonitorJSONCPUDataAddFeatures(virCPUData *data,
 }
 
 
-static int
-qemuMonitorJSONGetCPUData(qemuMonitor *mon,
-                          bool qomListGet,
-                          const char *cpuQOMPath,
-                          qemuMonitorCPUFeatureTranslationCallback translate,
-                          virCPUData *data)
-{
-    g_auto(GStrv) props = NULL;
-
-    if (qemuMonitorJSONGetCPUProperties(mon, qomListGet, cpuQOMPath, &props) < 0)
-        return -1;
-
-    if (qemuMonitorJSONCPUDataAddFeatures(data, props, translate) < 0)
-        return -1;
-
-    return 0;
-}
-
-
 static int
 qemuMonitorJSONGetCPUDataDisabled(qemuMonitor *mon,
                                   const char *cpuQOMPath,
@@ -6790,13 +6771,17 @@ qemuMonitorJSONGetGuestCPU(qemuMonitor *mon,
 {
     g_autoptr(virCPUData) cpuEnabled = NULL;
     g_autoptr(virCPUData) cpuDisabled = NULL;
+    g_auto(GStrv) propsEnabled = NULL;
 
     if (!(cpuEnabled = virCPUDataNew(arch)) ||
         !(cpuDisabled = virCPUDataNew(arch)))
         return -1;
 
-    if (qemuMonitorJSONGetCPUData(mon, qomListGet, cpuQOMPath,
-                                  translate, cpuEnabled) < 0)
+    if (qemuMonitorJSONGetCPUProperties(mon, qomListGet, cpuQOMPath,
+                                        &propsEnabled) < 0)
+        return -1;
+
+    if (qemuMonitorJSONCPUDataAddFeatures(cpuEnabled, propsEnabled, translate) < 0)
         return -1;
 
     if (disabled &&
-- 
2.51.0