maint: avoid 'const fooPtr' in tests

'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@redhat.com>
This commit is contained in:
Eric Blake 2013-10-04 19:40:19 -06:00
parent 1b7ec657c5
commit b8984770dc
3 changed files with 15 additions and 15 deletions

View File

@ -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)
{

View File

@ -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;

View File

@ -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;
@ -1112,8 +1113,7 @@ cleanup:
static int \
testQemuMonitorJSON ## funcName(const void *opaque) \
{ \
const testQemuMonitorJSONSimpleFuncDataPtr data = \
(const testQemuMonitorJSONSimpleFuncDataPtr) opaque; \
const testQemuMonitorJSONSimpleFuncData *data = opaque; \
virDomainXMLOptionPtr xmlopt = data->xmlopt; \
qemuMonitorTestPtr test = qemuMonitorTestNewSimple(true, xmlopt); \
const char *reply = data->reply; \