[libvirt] [PATCH] Swap position of nmodels and models parameters in cpuDecode()

All other libvirt functions use array first and then number of elements in that array. Let's make cpuDecode follow this rule. Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/cpu/cpu.c | 6 +++--- src/cpu/cpu.h | 8 ++++---- src/cpu/cpu_x86.c | 4 ++-- src/qemu/qemu_conf.c | 4 ++-- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c index ae8d37d..e9ecc98 100644 --- a/src/cpu/cpu.c +++ b/src/cpu/cpu.c @@ -119,8 +119,8 @@ cpuCompare(virCPUDefPtr host, int cpuDecode(virCPUDefPtr cpu, const union cpuData *data, - unsigned int nmodels, - const char **models) + const char **models, + unsigned int nmodels) { struct cpuArchDriver *driver; @@ -146,7 +146,7 @@ cpuDecode(virCPUDefPtr cpu, return -1; } - return driver->decode(cpu, data, nmodels, models); + return driver->decode(cpu, data, models, nmodels); } diff --git a/src/cpu/cpu.h b/src/cpu/cpu.h index 1e04993..7ee0ce6 100644 --- a/src/cpu/cpu.h +++ b/src/cpu/cpu.h @@ -48,8 +48,8 @@ typedef virCPUCompareResult typedef int (*cpuArchDecode) (virCPUDefPtr cpu, const union cpuData *data, - unsigned int nmodels, - const char **models); + const char **models, + unsigned int nmodels); typedef int (*cpuArchEncode) (const virCPUDefPtr cpu, @@ -95,8 +95,8 @@ cpuCompare (virCPUDefPtr host, extern int cpuDecode (virCPUDefPtr cpu, const union cpuData *data, - unsigned int nmodels, - const char **models); + const char **models, + unsigned int nmodels); extern int cpuEncode (const char *arch, diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index 7ae7fbf..c6ed078 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -940,8 +940,8 @@ x86GuestData(virCPUDefPtr host, static int x86Decode(virCPUDefPtr cpu, const union cpuData *data, - unsigned int nmodels, - const char **models) + const char **models, + unsigned int nmodels) { int ret = -1; struct x86_map *map; diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index 3988582..ca32dc0 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -1016,7 +1016,7 @@ qemudCapsInitCPU(virCapsPtr caps, cpu->threads = nodeinfo.threads; if (!(data = cpuNodeData(arch)) - || cpuDecode(cpu, data, 0, NULL) < 0) + || cpuDecode(cpu, data, NULL, 0) < 0) goto error; caps->host.cpu = cpu; @@ -2959,7 +2959,7 @@ qemuBuildCpuArgStr(const struct qemud_driver *driver, if (VIR_ALLOC(guest) < 0 || !(guest->arch = strdup(ut->machine))) goto no_memory; - if (cpuDecode(guest, data, ncpus, cpus) < 0) + if (cpuDecode(guest, data, cpus, ncpus) < 0) goto cleanup; virBufferVSprintf(&buf, "%s", guest->model); -- 1.6.6.1

On Thu, Feb 11, 2010 at 10:47:43AM +0100, Jiri Denemark wrote:
All other libvirt functions use array first and then number of elements in that array. Let's make cpuDecode follow this rule.
Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/cpu/cpu.c | 6 +++--- src/cpu/cpu.h | 8 ++++---- src/cpu/cpu_x86.c | 4 ++-- src/qemu/qemu_conf.c | 4 ++-- 4 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c index ae8d37d..e9ecc98 100644 --- a/src/cpu/cpu.c +++ b/src/cpu/cpu.c @@ -119,8 +119,8 @@ cpuCompare(virCPUDefPtr host, int cpuDecode(virCPUDefPtr cpu, const union cpuData *data, - unsigned int nmodels, - const char **models) + const char **models, + unsigned int nmodels) { struct cpuArchDriver *driver;
@@ -146,7 +146,7 @@ cpuDecode(virCPUDefPtr cpu, return -1; }
- return driver->decode(cpu, data, nmodels, models); + return driver->decode(cpu, data, models, nmodels); }
diff --git a/src/cpu/cpu.h b/src/cpu/cpu.h index 1e04993..7ee0ce6 100644 --- a/src/cpu/cpu.h +++ b/src/cpu/cpu.h @@ -48,8 +48,8 @@ typedef virCPUCompareResult typedef int (*cpuArchDecode) (virCPUDefPtr cpu, const union cpuData *data, - unsigned int nmodels, - const char **models); + const char **models, + unsigned int nmodels);
typedef int (*cpuArchEncode) (const virCPUDefPtr cpu, @@ -95,8 +95,8 @@ cpuCompare (virCPUDefPtr host, extern int cpuDecode (virCPUDefPtr cpu, const union cpuData *data, - unsigned int nmodels, - const char **models); + const char **models, + unsigned int nmodels);
extern int cpuEncode (const char *arch, diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index 7ae7fbf..c6ed078 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -940,8 +940,8 @@ x86GuestData(virCPUDefPtr host, static int x86Decode(virCPUDefPtr cpu, const union cpuData *data, - unsigned int nmodels, - const char **models) + const char **models, + unsigned int nmodels) { int ret = -1; struct x86_map *map; diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index 3988582..ca32dc0 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -1016,7 +1016,7 @@ qemudCapsInitCPU(virCapsPtr caps, cpu->threads = nodeinfo.threads;
if (!(data = cpuNodeData(arch)) - || cpuDecode(cpu, data, 0, NULL) < 0) + || cpuDecode(cpu, data, NULL, 0) < 0) goto error;
caps->host.cpu = cpu; @@ -2959,7 +2959,7 @@ qemuBuildCpuArgStr(const struct qemud_driver *driver, if (VIR_ALLOC(guest) < 0 || !(guest->arch = strdup(ut->machine))) goto no_memory;
- if (cpuDecode(guest, data, ncpus, cpus) < 0) + if (cpuDecode(guest, data, cpus, ncpus) < 0) goto cleanup;
virBufferVSprintf(&buf, "%s", guest->model);
Sure ! ACK, thanks ! Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/
participants (2)
-
Daniel Veillard
-
Jiri Denemark