[libvirt] [PATCH 1/3] cpu: use typedefs for enums in "src/cpu/cpu_map.h"

Julio Faracco jcfaracco at gmail.com
Sun Jun 1 00:22:28 UTC 2014


In "src/cpu/" there are some enumerations (enum) declarations.
Similar to the recent cleanup to "src/util", "src/conf" and other
directories, it's better to use a typedef for variable types,
function types and other usages. Other enumeration and folders will
be changed to typedef's in the future. Specially, in files that are
in different places of "src/util" and "src/conf". Most of the files
changed in this commit are related to CPU (cpu_map.h) enums.

Signed-off-by: Julio Faracco <jcfaracco at gmail.com>
---
 src/cpu/cpu.c         |    2 +-
 src/cpu/cpu_map.c     |    2 +-
 src/cpu/cpu_map.h     |    6 +++---
 src/cpu/cpu_powerpc.c |    2 +-
 src/cpu/cpu_x86.c     |    2 +-
 5 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c
index 528e1a7..c3d66dd 100644
--- a/src/cpu/cpu.c
+++ b/src/cpu/cpu.c
@@ -729,7 +729,7 @@ struct cpuGetModelsData
 };
 
 static int
-cpuGetArchModelsCb(enum cpuMapElement element,
+cpuGetArchModelsCb(cpuMapElement element,
                    xmlXPathContextPtr ctxt,
                    void *cbdata)
 {
diff --git a/src/cpu/cpu_map.c b/src/cpu/cpu_map.c
index 68d287a..4706f67 100644
--- a/src/cpu/cpu_map.c
+++ b/src/cpu/cpu_map.c
@@ -42,7 +42,7 @@ VIR_ENUM_IMPL(cpuMapElement, CPU_MAP_ELEMENT_LAST,
 
 
 static int load(xmlXPathContextPtr ctxt,
-                enum cpuMapElement element,
+                cpuMapElement element,
                 cpuMapLoadCallback callback,
                 void *data)
 {
diff --git a/src/cpu/cpu_map.h b/src/cpu/cpu_map.h
index 23ce888..fcd6c34 100644
--- a/src/cpu/cpu_map.h
+++ b/src/cpu/cpu_map.h
@@ -27,19 +27,19 @@
 # include "virxml.h"
 
 
-enum cpuMapElement {
+typedef enum {
     CPU_MAP_ELEMENT_VENDOR,
     CPU_MAP_ELEMENT_FEATURE,
     CPU_MAP_ELEMENT_MODEL,
 
     CPU_MAP_ELEMENT_LAST
-};
+} cpuMapElement;
 
 VIR_ENUM_DECL(cpuMapElement)
 
 
 typedef int
-(*cpuMapLoadCallback)  (enum cpuMapElement element,
+(*cpuMapLoadCallback)  (cpuMapElement element,
                         xmlXPathContextPtr ctxt,
                         void *data);
 
diff --git a/src/cpu/cpu_powerpc.c b/src/cpu/cpu_powerpc.c
index 372272f..05fa55b 100644
--- a/src/cpu/cpu_powerpc.c
+++ b/src/cpu/cpu_powerpc.c
@@ -273,7 +273,7 @@ ppcModelLoad(xmlXPathContextPtr ctxt,
 }
 
 static int
-ppcMapLoadCallback(enum cpuMapElement element,
+ppcMapLoadCallback(cpuMapElement element,
                    xmlXPathContextPtr ctxt,
                    void *data)
 {
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
index 06fbfba..72c5216 100644
--- a/src/cpu/cpu_x86.c
+++ b/src/cpu/cpu_x86.c
@@ -1098,7 +1098,7 @@ x86MapFree(struct x86_map *map)
 
 
 static int
-x86MapLoadCallback(enum cpuMapElement element,
+x86MapLoadCallback(cpuMapElement element,
                    xmlXPathContextPtr ctxt,
                    void *data)
 {
-- 
1.7.10.4




More information about the libvir-list mailing list