[libvirt PATCH v2 8/8] cpu: Replace VIR_FREE with g_free

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

 



Note the use of g_clear_pointer(..., g_free) in ppc64DataClear and virCPUx86Baseline.

Signed-off-by: Tim Wiederhake <twiederh@xxxxxxxxxx>
---
 src/cpu/cpu.c       |  2 +-
 src/cpu/cpu_ppc64.c | 18 +++++++++---------
 src/cpu/cpu_x86.c   |  8 ++++----
 3 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c
index c3eef52c79..188c5d86b5 100644
--- a/src/cpu/cpu.c
+++ b/src/cpu/cpu.c
@@ -315,7 +315,7 @@ virCPUDataFree(virCPUDataPtr data)
     if ((driver = cpuGetSubDriver(data->arch)) && driver->dataFree)
         driver->dataFree(data);
     else
-        VIR_FREE(data);
+        g_free(data);
 }
 
 
diff --git a/src/cpu/cpu_ppc64.c b/src/cpu/cpu_ppc64.c
index 6477b4bce7..2fedcd25da 100644
--- a/src/cpu/cpu_ppc64.c
+++ b/src/cpu/cpu_ppc64.c
@@ -126,7 +126,7 @@ ppc64DataClear(virCPUppc64Data *data)
     if (!data)
         return;
 
-    VIR_FREE(data->pvr);
+    g_clear_pointer(&data->pvr, g_free);
 }
 
 static int
@@ -151,8 +151,8 @@ ppc64VendorFree(virCPUppc64VendorPtr vendor)
     if (!vendor)
         return;
 
-    VIR_FREE(vendor->name);
-    VIR_FREE(vendor);
+    g_free(vendor->name);
+    g_free(vendor);
 }
 G_DEFINE_AUTOPTR_CLEANUP_FUNC(virCPUppc64Vendor, ppc64VendorFree);
 
@@ -177,8 +177,8 @@ ppc64ModelFree(virCPUppc64ModelPtr model)
         return;
 
     ppc64DataClear(&model->data);
-    VIR_FREE(model->name);
-    VIR_FREE(model);
+    g_free(model->name);
+    g_free(model);
 }
 G_DEFINE_AUTOPTR_CLEANUP_FUNC(virCPUppc64Model, ppc64ModelFree);
 
@@ -261,13 +261,13 @@ ppc64MapFree(virCPUppc64MapPtr map)
 
     for (i = 0; i < map->nmodels; i++)
         ppc64ModelFree(map->models[i]);
-    VIR_FREE(map->models);
+    g_free(map->models);
 
     for (i = 0; i < map->nvendors; i++)
         ppc64VendorFree(map->vendors[i]);
-    VIR_FREE(map->vendors);
+    g_free(map->vendors);
 
-    VIR_FREE(map);
+    g_free(map);
 }
 G_DEFINE_AUTOPTR_CLEANUP_FUNC(virCPUppc64Map, ppc64MapFree);
 
@@ -584,7 +584,7 @@ virCPUppc64DataFree(virCPUDataPtr data)
         return;
 
     ppc64DataClear(&data->data.ppc64);
-    VIR_FREE(data);
+    g_free(data);
 }
 
 
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
index db1b2e55a1..0e533c62e1 100644
--- a/src/cpu/cpu_x86.c
+++ b/src/cpu/cpu_x86.c
@@ -493,7 +493,7 @@ virCPUx86DataFree(virCPUDataPtr data)
         return;
 
     virCPUx86DataClear(&data->data.x86);
-    VIR_FREE(data);
+    g_free(data);
 }
 
 
@@ -2207,7 +2207,7 @@ x86Decode(virCPUDefPtr cpu,
             if (x86FeatureIsMigratable(cpuModel->features[i].name, map)) {
                 i++;
             } else {
-                VIR_FREE(cpuModel->features[i].name);
+                g_free(cpuModel->features[i].name);
                 VIR_DELETE_ELEMENT_INPLACE(cpuModel->features, i,
                                            cpuModel->nfeatures);
             }
@@ -2892,7 +2892,7 @@ virCPUx86Baseline(virCPUDefPtr *cpus,
         cpu->fallback = VIR_CPU_FALLBACK_FORBID;
 
     if (!outputVendor)
-        VIR_FREE(cpu->vendor);
+        g_clear_pointer(&cpu->vendor, g_free);
 
     return g_steal_pointer(&cpu);
 }
@@ -2914,7 +2914,7 @@ x86UpdateHostModel(virCPUDefPtr guest,
         return -1;
 
     if (guest->vendor_id) {
-        VIR_FREE(updated->vendor_id);
+        g_free(updated->vendor_id);
         updated->vendor_id = g_strdup(guest->vendor_id);
     }
 
-- 
2.26.2




[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