1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-22 17:34:18 +03:00

Fixed up numerous compiler warnings

This commit is contained in:
Daniel P. Berrange 2007-03-06 21:55:44 +00:00
parent 955f12037e
commit d6db609d74
17 changed files with 52 additions and 35 deletions

View File

@ -1,3 +1,14 @@
Tue Mar 06 16:52:12 EST 2007 Daniel P. Berrange <berrange@redhat.com>
* include/libvirt/libvirt.h.in, python/libvir.c, src/driver.h
src/libvirt.c, src/qemu_internal.c, src/test.c, src/virsh.c,
src/xend_internal.c, src/xm_intenral.c: Change const char **
to char **const to fix compiler warnings
* python/Makefile.am: Don't warn about redundant decls
* python/libvirt_wrap.h: Ensure PyGILState is always initialized
* tests/reconnect.c: Added ATTRIBUTE_UNUSED annotation
All patches from Richard Jones
Tue Mar 06 14:21:12 EST 2007 Daniel P. Berrange <berrange@redhat.com>
* src/xend_internal.c, src/xml.c, src/xm_internal.c: Support

View File

@ -1,4 +1,4 @@
/*
/* -*- c -*-
* libvirt.h:
* Summary: core interfaces for the libvirt library
* Description: Provides the interfaces of the libvirt library to handle
@ -324,7 +324,7 @@ virDomainPtr virDomainDefineXML (virConnectPtr conn,
int virDomainUndefine (virDomainPtr domain);
int virConnectNumOfDefinedDomains (virConnectPtr conn);
int virConnectListDefinedDomains (virConnectPtr conn,
const char **names,
char **const names,
int maxnames);
int virDomainCreate (virDomainPtr domain);
@ -472,7 +472,7 @@ typedef virNetwork *virNetworkPtr;
*/
int virConnectNumOfNetworks (virConnectPtr conn);
int virConnectListNetworks (virConnectPtr conn,
const char **names,
char **const names,
int maxnames);
/*
@ -480,7 +480,7 @@ int virConnectListNetworks (virConnectPtr conn,
*/
int virConnectNumOfDefinedNetworks (virConnectPtr conn);
int virConnectListDefinedNetworks (virConnectPtr conn,
const char **names,
char **const names,
int maxnames);
/*

View File

@ -1,4 +1,4 @@
/*
/* -*- c -*-
* libvirt.h:
* Summary: core interfaces for the libvirt library
* Description: Provides the interfaces of the libvirt library to handle
@ -324,7 +324,7 @@ virDomainPtr virDomainDefineXML (virConnectPtr conn,
int virDomainUndefine (virDomainPtr domain);
int virConnectNumOfDefinedDomains (virConnectPtr conn);
int virConnectListDefinedDomains (virConnectPtr conn,
const char **names,
char **const names,
int maxnames);
int virDomainCreate (virDomainPtr domain);
@ -472,7 +472,7 @@ typedef virNetwork *virNetworkPtr;
*/
int virConnectNumOfNetworks (virConnectPtr conn);
int virConnectListNetworks (virConnectPtr conn,
const char **names,
char **const names,
int maxnames);
/*
@ -480,7 +480,7 @@ int virConnectListNetworks (virConnectPtr conn,
*/
int virConnectNumOfDefinedNetworks (virConnectPtr conn);
int virConnectListDefinedNetworks (virConnectPtr conn,
const char **names,
char **const names,
int maxnames);
/*

View File

@ -4,6 +4,7 @@ Makefile.in
.libs
*.lo
*.la
*.loT
libvirt.py
libvirt-export.c
libvirtclass.txt

View File

@ -33,7 +33,9 @@ all-local: libvirt.py
python_LTLIBRARIES = libvirtmod.la
libvirtmod_la_SOURCES = libvir.c types.c libvirt-py.c libvirt-py.h
libvirtmod_la_LIBADD = $(mylibs)
libvirtmod_la_LIBADD = $(mylibs)
# Python header files contain a redundant decl, hence:
libvirtmod_la_CFLAGS = -Wno-redundant-decls
libvirt.py: $(srcdir)/libvir.py libvirtclass.py
cat $(srcdir)/libvir.py libvirtclass.py > libvirt.py

View File

@ -15,7 +15,7 @@
#include "libvirt_wrap.h"
#include "libvirt-py.h"
void initlibvirmod(void);
extern void initlibvirtmod(void);
PyObject *libvirt_virDomainGetUUID(PyObject *self ATTRIBUTE_UNUSED, PyObject *args);
PyObject *libvirt_virGetLastError(PyObject *self ATTRIBUTE_UNUSED, PyObject *args);
@ -266,7 +266,7 @@ libvirt_virConnectListDefinedDomains(PyObject *self ATTRIBUTE_UNUSED,
Py_INCREF(Py_None);
return (Py_None);
}
c_retval = virConnectListDefinedDomains(conn, (const char **)names, c_retval);
c_retval = virConnectListDefinedDomains(conn, names, c_retval);
if (c_retval < 0) {
free(names);
Py_INCREF(Py_None);
@ -375,7 +375,7 @@ libvirt_virDomainGetUUID(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
return(py_retval);
}
PyObject *
static PyObject *
libvirt_virDomainLookupByUUID(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
PyObject *py_retval;
virDomainPtr c_retval;

View File

@ -90,7 +90,7 @@ PyObject * libvirt_virDomainPtrWrap(virDomainPtr node);
#define LIBVIRT_ENSURE_THREAD_STATE \
LIBVIRT_STMT_START { \
PyGILState_STATE _save; \
PyGILState_STATE _save = PyGILState_UNLOCKED; \
if (PyEval_ThreadsInitialized()) \
_save = PyGILState_Ensure();

View File

@ -104,7 +104,7 @@ typedef char *
int flags);
typedef int
(*virDrvListDefinedDomains) (virConnectPtr conn,
const char **names,
char **const names,
int maxnames);
typedef int
(*virDrvNumOfDefinedDomains) (virConnectPtr conn);
@ -197,13 +197,13 @@ typedef int
(*virDrvNumOfNetworks) (virConnectPtr conn);
typedef int
(*virDrvListNetworks) (virConnectPtr conn,
const char **names,
char **const names,
int maxnames);
typedef int
(*virDrvNumOfDefinedNetworks) (virConnectPtr conn);
typedef int
(*virDrvListDefinedNetworks) (virConnectPtr conn,
const char **names,
char **const names,
int maxnames);
typedef virNetworkPtr
(*virDrvNetworkLookupByUUID) (virConnectPtr conn,

View File

@ -1795,7 +1795,7 @@ virConnectNumOfDefinedDomains(virConnectPtr conn)
* Returns the number of names provided in the array or -1 in case of error
*/
int
virConnectListDefinedDomains(virConnectPtr conn, const char **names,
virConnectListDefinedDomains(virConnectPtr conn, char **const names,
int maxnames) {
int ret = -1;
int i;
@ -2234,7 +2234,7 @@ virConnectNumOfNetworks(virConnectPtr conn)
* Returns the number of networks found or -1 in case of error
*/
int
virConnectListNetworks(virConnectPtr conn, const char **names, int maxnames)
virConnectListNetworks(virConnectPtr conn, char **const names, int maxnames)
{
int ret = -1;
int i;
@ -2305,7 +2305,7 @@ virConnectNumOfDefinedNetworks(virConnectPtr conn)
* Returns the number of names provided in the array or -1 in case of error
*/
int
virConnectListDefinedNetworks(virConnectPtr conn, const char **names,
virConnectListDefinedNetworks(virConnectPtr conn, char **const names,
int maxnames) {
int ret = -1;
int i;

View File

@ -717,7 +717,7 @@ static int qemuNumOfDefinedDomains(virConnectPtr conn) {
}
static int qemuListDefinedDomains(virConnectPtr conn,
const char **names,
char **const names,
int maxnames){
struct qemud_packet req, reply;
int i, nDomains;
@ -878,7 +878,7 @@ static int qemuNumOfNetworks(virConnectPtr conn) {
}
static int qemuListNetworks(virConnectPtr conn,
const char **names,
char **const names,
int maxnames) {
struct qemud_packet req, reply;
int i, nNetworks;
@ -916,7 +916,7 @@ static int qemuNumOfDefinedNetworks(virConnectPtr conn) {
}
static int qemuListDefinedNetworks(virConnectPtr conn,
const char **names,
char **const names,
int maxnames) {
struct qemud_packet req, reply;
int i, nNetworks;

View File

@ -76,7 +76,7 @@ char * testDomainDumpXML(virDomainPtr domain, int flags);
int testNumOfDefinedDomains(virConnectPtr conn);
int testListDefinedDomains(virConnectPtr conn,
const char **names,
char **const names,
int maxnames);
virDomainPtr testDomainDefineXML(virConnectPtr conn,
@ -1289,7 +1289,7 @@ int testNumOfDefinedDomains(virConnectPtr conn) {
}
int testListDefinedDomains(virConnectPtr conn,
const char **names,
char **const names,
int maxnames) {
testCon *con = &node->connections[conn->handle];
int n = 0, i;

View File

@ -471,7 +471,7 @@ cmdList(vshControl * ctl, vshCmd * cmd ATTRIBUTE_UNUSED)
int all = vshCommandOptBool(cmd, "all");
int active = !inactive || all ? 1 : 0;
int *ids = NULL, maxid = 0, i;
const char **names = NULL;
char **names = NULL;
int maxname = 0;
inactive |= all;
@ -1925,7 +1925,7 @@ cmdNetworkList(vshControl * ctl, vshCmd * cmd ATTRIBUTE_UNUSED)
int all = vshCommandOptBool(cmd, "all");
int active = !inactive || all ? 1 : 0;
int maxactive = 0, maxinactive = 0, i;
const char **activeNames = NULL, **inactiveNames = NULL;
char **activeNames = NULL, **inactiveNames = NULL;
inactive |= all;
if (!vshConnectionUsability(ctl, ctl->conn, TRUE))

View File

@ -1127,7 +1127,7 @@ virXen_getvcpusinfo(int handle, int id, unsigned int vcpu, virVcpuInfoPtr ipt,
* Initialize the hypervisor layer. Try to detect the kind of interface
* used i.e. pre or post changeset 10277
*/
int
static int
xenHypervisorInit(void)
{
int fd, ret, cmd;

View File

@ -41,7 +41,7 @@
static const char * xenDaemonGetType(virConnectPtr conn);
static int xenDaemonListDomains(virConnectPtr conn, int *ids, int maxids);
static int xenDaemonNumOfDomains(virConnectPtr conn);
static int xenDaemonListDefinedDomains(virConnectPtr conn, const char **names, int maxnames);
static int xenDaemonListDefinedDomains(virConnectPtr conn, char **const names, int maxnames);
static int xenDaemonNumOfDefinedDomains(virConnectPtr conn);
static virDomainPtr xenDaemonLookupByID(virConnectPtr conn, int id);
static virDomainPtr xenDaemonLookupByUUID(virConnectPtr conn,
@ -1038,7 +1038,8 @@ xenDaemonDomainLookupByName_ids(virConnectPtr xend, const char *domname,
_("domain information incorrect domid not numeric"));
ret = -1;
} else if (uuid != NULL) {
char **ptr = (char **) &uuid;
char *uuid_c = (char *) uuid;
char **ptr = &uuid_c;
if (sexpr_uuid(ptr, root, "domain/uuid") == NULL) {
virXendError(xend, VIR_ERR_INTERNAL_ERROR,
@ -1108,6 +1109,7 @@ error:
}
#ifndef PROXY
static int
xend_detect_config_version(virConnectPtr conn) {
struct sexpr *root;
@ -1135,7 +1137,6 @@ xend_detect_config_version(virConnectPtr conn) {
return conn->xendConfigVersion;
}
#ifndef PROXY
/**
* xend_node_shutdown:
* @xend: A xend instance
@ -3087,7 +3088,7 @@ error:
return(ret);
}
int xenDaemonListDefinedDomains(virConnectPtr conn, const char **names, int maxnames) {
int xenDaemonListDefinedDomains(virConnectPtr conn, char **const names, int maxnames) {
struct sexpr *root = NULL;
int ret = -1;
struct sexpr *_for_i, *node;

View File

@ -2196,7 +2196,7 @@ struct xenXMListIteratorContext {
virConnectPtr conn;
int max;
int count;
const char **names;
char ** names;
};
static void xenXMListIterator(const void *payload ATTRIBUTE_UNUSED, const char *name, const void *data) {
@ -2220,7 +2220,7 @@ static void xenXMListIterator(const void *payload ATTRIBUTE_UNUSED, const char *
* List all defined domains, filtered to remove any which
* are currently running
*/
int xenXMListDefinedDomains(virConnectPtr conn, const char **names, int maxnames) {
int xenXMListDefinedDomains(virConnectPtr conn, char **const names, int maxnames) {
struct xenXMListIteratorContext ctx;
if (!VIR_IS_CONNECT(conn)) {

View File

@ -46,7 +46,7 @@ virDomainPtr xenXMDomainLookupByName(virConnectPtr conn, const char *domname);
virDomainPtr xenXMDomainLookupByUUID(virConnectPtr conn,
const unsigned char *uuid);
int xenXMListDefinedDomains(virConnectPtr conn, const char **names, int maxnames);
int xenXMListDefinedDomains(virConnectPtr conn, char ** const names, int maxnames);
int xenXMNumOfDefinedDomains(virConnectPtr conn);
int xenXMDomainCreate(virDomainPtr domain);

View File

@ -2,8 +2,10 @@
#include <stdlib.h>
#include <libvirt/libvirt.h>
#include <libvirt/virterror.h>
#include "internal.h"
static void errorHandler(void *userData, virErrorPtr error) {
static void errorHandler(void *userData ATTRIBUTE_UNUSED,
virErrorPtr error ATTRIBUTE_UNUSED) {
}
int main(void) {