[PATCH 05/18] cpu: Reorder functions in the ppc64 driver

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

 



Having the functions grouped together this way will avoid further
shuffling around down the line.

No functional changes.
---
 src/cpu/cpu_ppc64.c | 135 +++++++++++++++++++++++++---------------------------
 1 file changed, 66 insertions(+), 69 deletions(-)

diff --git a/src/cpu/cpu_ppc64.c b/src/cpu/cpu_ppc64.c
index c769221..20c68ca 100644
--- a/src/cpu/cpu_ppc64.c
+++ b/src/cpu/cpu_ppc64.c
@@ -57,6 +57,32 @@ struct ppc64_map {
     struct ppc64_model *models;
 };
 
+static void
+ppc64VendorFree(struct ppc64_vendor *vendor)
+{
+    if (!vendor)
+        return;
+
+    VIR_FREE(vendor->name);
+    VIR_FREE(vendor);
+}
+
+static struct ppc64_vendor *
+ppc64VendorFind(const struct ppc64_map *map,
+                const char *name)
+{
+    struct ppc64_vendor *vendor;
+
+    vendor = map->vendors;
+    while (vendor) {
+        if (STREQ(vendor->name, name))
+            return vendor;
+
+        vendor = vendor->next;
+    }
+
+    return NULL;
+}
 
 static void
 ppc64ModelFree(struct ppc64_model *model)
@@ -69,6 +95,26 @@ ppc64ModelFree(struct ppc64_model *model)
 }
 
 static struct ppc64_model *
+ppc64ModelCopy(const struct ppc64_model *model)
+{
+    struct ppc64_model *copy;
+
+    if (!model)
+        return NULL;
+
+    if (VIR_ALLOC(copy) < 0 ||
+        VIR_STRDUP(copy->name, model->name) < 0) {
+        ppc64ModelFree(copy);
+        return NULL;
+    }
+
+    copy->data.pvr = model->data.pvr;
+    copy->vendor = model->vendor;
+
+    return copy;
+}
+
+static struct ppc64_model *
 ppc64ModelFind(const struct ppc64_map *map,
                const char *name)
 {
@@ -111,53 +157,6 @@ ppc64ModelFindPVR(const struct ppc64_map *map,
 }
 
 static struct ppc64_model *
-ppc64ModelCopy(const struct ppc64_model *model)
-{
-    struct ppc64_model *copy;
-
-    if (!model)
-        return NULL;
-
-    if (VIR_ALLOC(copy) < 0 ||
-        VIR_STRDUP(copy->name, model->name) < 0) {
-        ppc64ModelFree(copy);
-        return NULL;
-    }
-
-    copy->data.pvr = model->data.pvr;
-    copy->vendor = model->vendor;
-
-    return copy;
-}
-
-static struct ppc64_vendor *
-ppc64VendorFind(const struct ppc64_map *map,
-                const char *name)
-{
-    struct ppc64_vendor *vendor;
-
-    vendor = map->vendors;
-    while (vendor) {
-        if (STREQ(vendor->name, name))
-            return vendor;
-
-        vendor = vendor->next;
-    }
-
-    return NULL;
-}
-
-static void
-ppc64VendorFree(struct ppc64_vendor *vendor)
-{
-    if (!vendor)
-        return;
-
-    VIR_FREE(vendor->name);
-    VIR_FREE(vendor);
-}
-
-static struct ppc64_model *
 ppc64ModelFromCPU(const virCPUDef *cpu,
                   const struct ppc64_map *map)
 {
@@ -180,6 +179,26 @@ ppc64ModelFromCPU(const virCPUDef *cpu,
     return NULL;
 }
 
+static void
+ppc64MapFree(struct ppc64_map *map)
+{
+    if (!map)
+        return;
+
+    while (map->models) {
+        struct ppc64_model *model = map->models;
+        map->models = model->next;
+        ppc64ModelFree(model);
+    }
+
+    while (map->vendors) {
+        struct ppc64_vendor *vendor = map->vendors;
+        map->vendors = vendor->next;
+        ppc64VendorFree(vendor);
+    }
+
+    VIR_FREE(map);
+}
 
 static int
 ppc64VendorLoad(xmlXPathContextPtr ctxt,
@@ -304,27 +323,6 @@ ppc64MapLoadCallback(cpuMapElement element,
     return 0;
 }
 
-static void
-ppc64MapFree(struct ppc64_map *map)
-{
-    if (!map)
-        return;
-
-    while (map->models) {
-        struct ppc64_model *model = map->models;
-        map->models = model->next;
-        ppc64ModelFree(model);
-    }
-
-    while (map->vendors) {
-        struct ppc64_vendor *vendor = map->vendors;
-        map->vendors = vendor->next;
-        ppc64VendorFree(vendor);
-    }
-
-    VIR_FREE(map);
-}
-
 static struct ppc64_map *
 ppc64LoadMap(void)
 {
@@ -511,7 +509,6 @@ ppc64DriverDecode(virCPUDefPtr cpu,
     return ret;
 }
 
-
 static void
 ppc64DriverFree(virCPUDataPtr data)
 {
-- 
2.4.3

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[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]