On Tue, Aug 04, 2015 at 11:38:03 +0200, Andrea Bolognani wrote:
Use a typedef instead of the plain struct and heap allocation. This
will make it easier to extend the ppc64 specific CPU data later on.
---
src/cpu/cpu.h | 2 +-
src/cpu/cpu_ppc64.c | 81 ++++++++++++++++++++++++++++++++++++++----------
src/cpu/cpu_ppc64_data.h | 3 +-
3 files changed, 67 insertions(+), 19 deletions(-)
diff --git a/src/cpu/cpu.h b/src/cpu/cpu.h
index 49d4226..7375876 100644
--- a/src/cpu/cpu.h
+++ b/src/cpu/cpu.h
@@ -38,7 +38,7 @@ struct _virCPUData {
virArch arch;
union {
virCPUx86Data *x86;
- struct cpuPPC64Data ppc64;
+ virCPUppc64Data *ppc64;
/* generic driver needs no data */
} data;
};
diff --git a/src/cpu/cpu_ppc64.c b/src/cpu/cpu_ppc64.c
index 4428a55..d186d4c 100644
--- a/src/cpu/cpu_ppc64.c
+++ b/src/cpu/cpu_ppc64.c
@@ -48,7 +48,7 @@ struct ppc64_vendor {
struct ppc64_model {
char *name;
const struct ppc64_vendor *vendor;
- struct cpuPPC64Data data;
+ virCPUppc64Data *data;
struct ppc64_model *next;
};
@@ -58,6 +58,31 @@ struct ppc64_map {
};
static void
+ppc64DataFree(virCPUppc64Data *data)
+{
+ if (!data)
+ return;
This is redundant unless you want to add more fields in the structure
which will need to be freed here.
+
+ VIR_FREE(data);
+}
...
ACK
Jirka