'const fooPtr' is the same as 'foo * const' (the pointer won't
change, but it's contents can). But in general, if an interface
is trying to be const-correct, it should be using 'const foo *'
(the pointer is to data that can't be changed).
Fix up offenders in the testsuite.
* tests/cputest.c (cpuTestCompareXML): Use intended type.
* tests/qemucapabilitiestest.c (testQemuCaps): Likewise.
* tests/qemumonitorjsontest.c: Drop const.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
tests/cputest.c | 4 ++--
tests/qemucapabilitiestest.c | 2 +-
tests/qemumonitorjsontest.c | 21 +++++++++++----------
3 files changed, 14 insertions(+), 13 deletions(-)
diff --git a/tests/cputest.c b/tests/cputest.c
index 8e3640b..b80fac7 100644
--- a/tests/cputest.c
+++ b/tests/cputest.c
@@ -1,7 +1,7 @@
/*
* cputest.c: Test the libvirtd internal CPU APIs
*
- * Copyright (C) 2010-2012 Red Hat, Inc.
+ * Copyright (C) 2010-2013 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -153,7 +153,7 @@ cleanup_cpus:
static int
cpuTestCompareXML(const char *arch,
- const virCPUDefPtr cpu,
+ virCPUDef *cpu,
const char *name,
unsigned int flags)
{
diff --git a/tests/qemucapabilitiestest.c b/tests/qemucapabilitiestest.c
index 9902fc5..28f12e7 100644
--- a/tests/qemucapabilitiestest.c
+++ b/tests/qemucapabilitiestest.c
@@ -163,7 +163,7 @@ static int
testQemuCaps(const void *opaque)
{
int ret = -1;
- const testQemuDataPtr data = (const testQemuDataPtr) opaque;
+ const testQemuData *data = opaque;
char *repliesFile = NULL, *capsFile = NULL;
char *replies = NULL, *caps = NULL;
qemuMonitorTestPtr mon = NULL;
diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c
index 6ef877c..3e9348e 100644
--- a/tests/qemumonitorjsontest.c
+++ b/tests/qemumonitorjsontest.c
@@ -524,7 +524,7 @@ cleanup:
static int
testQemuMonitorJSONGetTPMModels(const void *data)
{
- const virDomainXMLOptionPtr xmlopt = (virDomainXMLOptionPtr)data;
+ virDomainXMLOptionPtr xmlopt = (virDomainXMLOptionPtr)data;
qemuMonitorTestPtr test = qemuMonitorTestNewSimple(true, xmlopt);
int ret = -1;
char **tpmmodels = NULL;
@@ -577,7 +577,7 @@ cleanup:
static int
testQemuMonitorJSONGetCommandLineOptionParameters(const void *data)
{
- const virDomainXMLOptionPtr xmlopt = (virDomainXMLOptionPtr)data;
+ virDomainXMLOptionPtr xmlopt = (virDomainXMLOptionPtr)data;
qemuMonitorTestPtr test = qemuMonitorTestNewSimple(true, xmlopt);
int ret = -1;
char **params = NULL;
@@ -678,7 +678,7 @@ cleanup:
static int
testQemuMonitorJSONAttachChardev(const void *data)
{
- const virDomainXMLOptionPtr xmlopt = (virDomainXMLOptionPtr)data;
+ virDomainXMLOptionPtr xmlopt = (virDomainXMLOptionPtr)data;
qemuMonitorTestPtr test = qemuMonitorTestNewSimple(true, xmlopt);
virDomainChrSourceDef chr;
int ret = 0;
@@ -759,7 +759,7 @@ cleanup:
static int
testQemuMonitorJSONDetachChardev(const void *data)
{
- const virDomainXMLOptionPtr xmlopt = (virDomainXMLOptionPtr)data;
+ virDomainXMLOptionPtr xmlopt = (virDomainXMLOptionPtr)data;
qemuMonitorTestPtr test = qemuMonitorTestNewSimple(true, xmlopt);
int ret = -1;
@@ -792,7 +792,7 @@ cleanup:
static int
testQemuMonitorJSONGetListPaths(const void *data)
{
- const virDomainXMLOptionPtr xmlopt = (virDomainXMLOptionPtr)data;
+ virDomainXMLOptionPtr xmlopt = (virDomainXMLOptionPtr)data;
qemuMonitorTestPtr test = qemuMonitorTestNewSimple(true, xmlopt);
int ret = -1;
qemuMonitorJSONListPathPtr *paths;
@@ -870,7 +870,7 @@ cleanup:
static int
testQemuMonitorJSONGetObjectProperty(const void *data)
{
- const virDomainXMLOptionPtr xmlopt = (virDomainXMLOptionPtr)data;
+ virDomainXMLOptionPtr xmlopt = (virDomainXMLOptionPtr)data;
qemuMonitorTestPtr test = qemuMonitorTestNewSimple(true, xmlopt);
int ret = -1;
qemuMonitorJSONObjectProperty prop;
@@ -913,7 +913,7 @@ cleanup:
static int
testQemuMonitorJSONSetObjectProperty(const void *data)
{
- const virDomainXMLOptionPtr xmlopt = (virDomainXMLOptionPtr)data;
+ virDomainXMLOptionPtr xmlopt = (virDomainXMLOptionPtr)data;
qemuMonitorTestPtr test = qemuMonitorTestNewSimple(true, xmlopt);
int ret = -1;
qemuMonitorJSONObjectProperty prop;
@@ -965,7 +965,7 @@ cleanup:
static int
testQemuMonitorJSONGetDeviceAliases(const void *data)
{
- const virDomainXMLOptionPtr xmlopt = (virDomainXMLOptionPtr)data;
+ virDomainXMLOptionPtr xmlopt = (virDomainXMLOptionPtr)data;
qemuMonitorTestPtr test = qemuMonitorTestNewSimple(true, xmlopt);
int ret = -1;
char **aliases = NULL;
@@ -1025,7 +1025,7 @@ cleanup:
static int
testQemuMonitorJSONCPU(const void *data)
{
- const virDomainXMLOptionPtr xmlopt = (virDomainXMLOptionPtr)data;
+ virDomainXMLOptionPtr xmlopt = (virDomainXMLOptionPtr)data;
qemuMonitorTestPtr test = qemuMonitorTestNewSimple(true, xmlopt);
int ret = -1;
bool running = false;
@@ -1084,7 +1084,8 @@ cleanup:
static int
testQemuMonitorJSONSimpleFunc(const void *opaque)
{
- const testQemuMonitorJSONSimpleFuncDataPtr data = (const
testQemuMonitorJSONSimpleFuncDataPtr) opaque;
+ testQemuMonitorJSONSimpleFuncDataPtr data =
+ (testQemuMonitorJSONSimpleFuncDataPtr) opaque;
virDomainXMLOptionPtr xmlopt = data->xmlopt;
qemuMonitorTestPtr test = qemuMonitorTestNewSimple(true, xmlopt);
const char *reply = data->reply;
--
1.8.3.1