[PATCH 12/14] qemu: Merge qemuMonitorJSONGetCPUDataDisabled in qemuMonitorJSONGetGuestCPU

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

The qemuMonitorJSONGetCPUDataDisabled 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 | 26 ++++++--------------------
 1 file changed, 6 insertions(+), 20 deletions(-)

diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index 06e0f3794e..6b736aefd0 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -6724,25 +6724,6 @@ qemuMonitorJSONCPUDataAddFeatures(virCPUData *data,
 }
 
 
-static int
-qemuMonitorJSONGetCPUDataDisabled(qemuMonitor *mon,
-                                  const char *cpuQOMPath,
-                                  qemuMonitorCPUFeatureTranslationCallback translate,
-                                  virCPUData *data)
-{
-    g_auto(GStrv) props = NULL;
-
-    if (qemuMonitorJSONGetStringListProperty(mon, cpuQOMPath,
-                                             "unavailable-features", &props) < 0)
-        return -1;
-
-    if (qemuMonitorJSONCPUDataAddFeatures(data, props, translate) < 0)
-        return -1;
-
-    return 0;
-}
-
-
 /**
  * qemuMonitorJSONGetGuestCPU:
  * @mon: Pointer to the monitor
@@ -6772,6 +6753,7 @@ qemuMonitorJSONGetGuestCPU(qemuMonitor *mon,
     g_autoptr(virCPUData) cpuEnabled = NULL;
     g_autoptr(virCPUData) cpuDisabled = NULL;
     g_auto(GStrv) propsEnabled = NULL;
+    g_auto(GStrv) propsDisabled = NULL;
 
     if (!(cpuEnabled = virCPUDataNew(arch)) ||
         !(cpuDisabled = virCPUDataNew(arch)))
@@ -6784,7 +6766,11 @@ qemuMonitorJSONGetGuestCPU(qemuMonitor *mon,
     if (qemuMonitorJSONCPUDataAddFeatures(cpuEnabled, propsEnabled, translate) < 0)
         return -1;
 
-    if (qemuMonitorJSONGetCPUDataDisabled(mon, cpuQOMPath, translate, cpuDisabled) < 0)
+    if (qemuMonitorJSONGetStringListProperty(mon, cpuQOMPath,
+                                             "unavailable-features", &propsDisabled) < 0)
+        return -1;
+
+    if (qemuMonitorJSONCPUDataAddFeatures(cpuDisabled, propsDisabled, translate) < 0)
         return -1;
 
     *enabled = g_steal_pointer(&cpuEnabled);
-- 
2.51.0