[libvirt] [PATCH 5/5] build: consistently use C99 varargs macros throughout

Eric Blake eblake at redhat.com
Mon Mar 1 23:38:32 UTC 2010


Conclusion of previous patches.

* src/cpu/cpu.h (virCPUReportError): Use C99 rather than GNU
vararg macro syntax.
* src/datatypes.c (virLibConnError): Likewise.
* src/interface/netcf_driver.c (interfaceReportError): Likewise.
* src/libvirt.c (virLibStreamError): Likewise.
* src/lxc/lxc_conf.h (lxcError): Likewise.
* src/network/bridge_driver.c (networkReportError): Likewise.
* src/nodeinfo.c (nodeReportError): Likewise.
* src/opennebula/one_conf.h (oneError): Likewise.
* src/openvz/openvz_conf.h (openvzError): Likewise.
* src/phyp/phyp_driver.c (PHYP_ERROR): Likewise.
* src/qemu/qemu_conf.h (qemuReportError): Likewise.
* src/remote/remote_driver.c (errorf): Likewise.
* src/security/security_driver.h (virSecurityReportError):
Likewise.
* src/test/test_driver.c (testError): Likewise.
* src/uml/uml_conf.h (umlReportError): Likewise.
* src/vbox/vbox_driver.c (vboxError): Likewise.
* src/vbox/vbox_tmpl.c (vboxError): Likewise.
---
 src/cpu/cpu.h                  |    6 +++---
 src/datatypes.c                |    6 +++---
 src/interface/netcf_driver.c   |    6 +++---
 src/libvirt.c                  |    6 +++---
 src/lxc/lxc_conf.h             |    5 +++--
 src/network/bridge_driver.c    |    4 ++--
 src/nodeinfo.c                 |    6 +++---
 src/opennebula/one_conf.h      |    8 +++++---
 src/openvz/openvz_conf.h       |    5 +++--
 src/phyp/phyp_driver.c         |    5 +++--
 src/qemu/qemu_conf.h           |    4 ++--
 src/remote/remote_driver.c     |    4 ++--
 src/security/security_driver.h |    6 +++---
 src/test/test_driver.c         |    4 ++--
 src/uml/uml_conf.h             |    6 +++---
 src/vbox/vbox_driver.c         |    5 +++--
 src/vbox/vbox_tmpl.c           |    5 +++--
 17 files changed, 49 insertions(+), 42 deletions(-)

diff --git a/src/cpu/cpu.h b/src/cpu/cpu.h
index c8d961d..4287ca3 100644
--- a/src/cpu/cpu.h
+++ b/src/cpu/cpu.h
@@ -1,7 +1,7 @@
 /*
  * cpu.h: internal functions for CPU manipulation
  *
- * Copyright (C) 2009--2010 Red Hat, Inc.
+ * Copyright (C) 2009-2010 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
@@ -30,9 +30,9 @@
 #include "cpu_x86_data.h"


-#define virCPUReportError(code, fmt...)                           \
+#define virCPUReportError(code, ...)                              \
     virReportErrorHelper(NULL, VIR_FROM_CPU, code, __FILE__,      \
-                         __FUNCTION__, __LINE__, fmt)
+                         __FUNCTION__, __LINE__, __VA_ARGS__)


 union cpuData {
diff --git a/src/datatypes.c b/src/datatypes.c
index fa342e0..01601d8 100644
--- a/src/datatypes.c
+++ b/src/datatypes.c
@@ -1,7 +1,7 @@
 /*
  * datatypes.h: management of structs for public data types
  *
- * Copyright (C) 2006-2009 Red Hat, Inc.
+ * Copyright (C) 2006-2010 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
@@ -31,9 +31,9 @@

 #define VIR_FROM_THIS VIR_FROM_NONE

-#define virLibConnError(conn, code, fmt...)                       \
+#define virLibConnError(conn, code, ...)                          \
     virReportErrorHelper(conn, VIR_FROM_THIS, code, __FILE__,     \
-                         __FUNCTION__, __LINE__, fmt)
+                         __FUNCTION__, __LINE__, __VA_ARGS__)

 /************************************************************************
  *									*
diff --git a/src/interface/netcf_driver.c b/src/interface/netcf_driver.c
index 7f4d43d..e44156e 100644
--- a/src/interface/netcf_driver.c
+++ b/src/interface/netcf_driver.c
@@ -2,7 +2,7 @@
  * interface_driver.c: backend driver methods to handle physical
  *                     interface configuration using the netcf library.
  *
- * Copyright (C) 2006-2009 Red Hat, Inc.
+ * Copyright (C) 2006-2010 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
@@ -33,9 +33,9 @@

 #define VIR_FROM_THIS VIR_FROM_INTERFACE

-#define interfaceReportError(conn, dom, net, code, fmt...)            \
+#define interfaceReportError(conn, dom, net, code, ...)               \
     virReportErrorHelper(conn, VIR_FROM_THIS, code, __FILE__,         \
-                           __FUNCTION__, __LINE__, fmt)
+                         __FUNCTION__, __LINE__, __VA_ARGS__)

 /* Main driver state */
 struct interface_driver
diff --git a/src/libvirt.c b/src/libvirt.c
index 9d50c92..b664728 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -2,7 +2,7 @@
  * libvirt.c: Main interfaces for the libvirt library to handle virtualization
  *           domains from a process running in domain 0
  *
- * Copyright (C) 2005,2006,2008,2009 Red Hat, Inc.
+ * Copyright (C) 2005-2006, 2008-2010 Red Hat, Inc.
  *
  * See COPYING.LIB for the License of this software
  *
@@ -618,9 +618,9 @@ virLibNodeDeviceError(virNodeDevicePtr dev, virErrorNumber error,
                     errmsg, info, NULL, 0, 0, errmsg, info);
 }

-#define virLibStreamError(conn, code, fmt...)                   \
+#define virLibStreamError(conn, code, ...)                      \
     virReportErrorHelper(conn, VIR_FROM_NONE, code, __FILE__,   \
-                         __FUNCTION__, __LINE__, fmt)
+                         __FUNCTION__, __LINE__, __VA_ARGS__)

 /**
  * virLibSecretError:
diff --git a/src/lxc/lxc_conf.h b/src/lxc/lxc_conf.h
index d0c5bb1..5cdf673 100644
--- a/src/lxc/lxc_conf.h
+++ b/src/lxc/lxc_conf.h
@@ -1,4 +1,5 @@
 /*
+ * Copyright (C) 2010 Red Hat, Inc.
  * Copyright IBM Corp. 2008
  *
  * lxc_conf.h: header file for linux container config functions
@@ -63,8 +64,8 @@ struct __lxc_driver {
 int lxcLoadDriverConfig(lxc_driver_t *driver);
 virCapsPtr lxcCapsInit(void);

-#define lxcError(code, fmt...)                                          \
+#define lxcError(code, ...)                                             \
     virReportErrorHelper(NULL, VIR_FROM_LXC, code, __FILE__,            \
-                         __FUNCTION__, __LINE__, fmt)
+                         __FUNCTION__, __LINE__, __VA_ARGS__)

 #endif /* LXC_CONF_H */
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index 4453707..83ab00e 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -63,9 +63,9 @@

 #define VIR_FROM_THIS VIR_FROM_NETWORK

-#define networkReportError(code, fmt...)                                \
+#define networkReportError(code, ...)                                   \
     virReportErrorHelper(NULL, VIR_FROM_NETWORK, code, __FILE__,        \
-                         __FUNCTION__, __LINE__, fmt)
+                         __FUNCTION__, __LINE__, __VA_ARGS__)

 /* Main driver state */
 struct network_driver {
diff --git a/src/nodeinfo.c b/src/nodeinfo.c
index 2d44609..4648be1 100644
--- a/src/nodeinfo.c
+++ b/src/nodeinfo.c
@@ -1,7 +1,7 @@
 /*
  * nodeinfo.c: Helper routines for OS specific node information
  *
- * Copyright (C) 2006, 2007, 2008 Red Hat, Inc.
+ * Copyright (C) 2006, 2007, 2008, 2010 Red Hat, Inc.
  * Copyright (C) 2006 Daniel P. Berrange
  *
  * This library is free software; you can redistribute it and/or
@@ -49,9 +49,9 @@

 #define VIR_FROM_THIS VIR_FROM_NONE

-#define nodeReportError(conn, code, fmt...)                              \
+#define nodeReportError(conn, code, ...)                                \
     virReportErrorHelper(conn, VIR_FROM_NONE, code, __FILE__,           \
-                         __FUNCTION__, __LINE__, fmt)
+                         __FUNCTION__, __LINE__, __VA_ARGS__)

 #ifdef __linux__
 #define CPUINFO_PATH "/proc/cpuinfo"
diff --git a/src/opennebula/one_conf.h b/src/opennebula/one_conf.h
index bb01026..5f24e2b 100644
--- a/src/opennebula/one_conf.h
+++ b/src/opennebula/one_conf.h
@@ -1,5 +1,7 @@
 /*----------------------------------------------------------------------------------*/
-/* Copyright 2002-2009, Distributed Systems Architecture Group, Universidad
+/*
+ * Copyright (C) 2010 Red Hat, Inc.
+ * Copyright 2002-2009, Distributed Systems Architecture Group, Universidad
  * Complutense de Madrid (dsa-research.org)
  *
  * This library is free software; you can redistribute it and/or
@@ -45,8 +47,8 @@ int oneSubmitVM(virConnectPtr conn ,one_driver_t* driver, virDomainObjPtr  vm);

 char* xmlOneTemplate(virDomainDefPtr def);

-#define oneError(conn, dom, code, fmt...)                               \
+#define oneError(conn, dom, code, ...)                                  \
     virReportErrorHelper(conn, VIR_FROM_ONE, code, __FILE__,            \
-                         __FUNCTION__, __LINE__, fmt)
+                         __FUNCTION__, __LINE__, __VA_ARGS__)

 #endif /* ONE_CONF_H */
diff --git a/src/openvz/openvz_conf.h b/src/openvz/openvz_conf.h
index c863a2a..fc5966b 100644
--- a/src/openvz/openvz_conf.h
+++ b/src/openvz/openvz_conf.h
@@ -1,6 +1,7 @@
 /*
  * openvz_config.h: config information for OpenVZ VPSs
  *
+ * Copyright (C) 2010 Red Hat, Inc.
  * Copyright (C) 2006, 2007 Binary Karma.
  * Copyright (C) 2006 Shuveb Hussain
  * Copyright (C) 2007 Anoop Joe Cyriac
@@ -34,9 +35,9 @@

 enum { OPENVZ_WARN, OPENVZ_ERR };

-#define openvzError(conn, code, fmt...)                                      \
+#define openvzError(conn, code, ...)                                       \
         virReportErrorHelper(conn, VIR_FROM_OPENVZ, code, __FILE__,        \
-                               __FUNCTION__, __LINE__, fmt)
+                             __FUNCTION__, __LINE__, __VA_ARGS__)


 /* OpenVZ commands - Replace with wrapper scripts later? */
diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c
index 1e8ed30..2c3896b 100644
--- a/src/phyp/phyp_driver.c
+++ b/src/phyp/phyp_driver.c
@@ -1,5 +1,6 @@

 /*
+ * Copyright (C) 2010 Red Hat, Inc.
  * Copyright IBM Corp. 2009
  *
  * phyp_driver.c: ssh layer to access Power Hypervisors
@@ -61,9 +62,9 @@

 #define VIR_FROM_THIS VIR_FROM_PHYP

-#define PHYP_ERROR(conn, code, fmt...)                                        \
+#define PHYP_ERROR(conn, code, ...)                                           \
     virReportErrorHelper(conn, VIR_FROM_PHYP, code, __FILE__, __FUNCTION__,   \
-                         __LINE__, fmt)
+                         __LINE__, __VA_ARGS__)

 /*
  * URI: phyp://user@[hmc|ivm]/managed_system
diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h
index 1821252..1134f62 100644
--- a/src/qemu/qemu_conf.h
+++ b/src/qemu/qemu_conf.h
@@ -161,9 +161,9 @@ typedef qemuDomainPCIAddressSet *qemuDomainPCIAddressSetPtr;
 #define QEMU_DRIVE_HOST_PREFIX "drive-"
 #define QEMU_VIRTIO_SERIAL_PREFIX "virtio-serial"

-#define qemuReportError(code, fmt...)                                   \
+#define qemuReportError(code, ...)                                      \
     virReportErrorHelper(NULL, VIR_FROM_QEMU, code, __FILE__,           \
-                         __FUNCTION__, __LINE__, fmt)
+                         __FUNCTION__, __LINE__, __VA_ARGS__)


 int qemudLoadDriverConfig(struct qemud_driver *driver,
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index def4617..b2d1de6 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -242,9 +242,9 @@ static int remoteAuthPolkit (virConnectPtr conn, struct private_data *priv, int
 #define error(conn, code, info)                                 \
     virReportErrorHelper(conn, VIR_FROM_QEMU, code, __FILE__,   \
                          __FUNCTION__, __LINE__, "%s", info)
-#define errorf(conn, code, fmt...)                              \
+#define errorf(conn, code, ...)                                 \
     virReportErrorHelper(conn, VIR_FROM_QEMU, code, __FILE__,   \
-                         __FUNCTION__, __LINE__, fmt)
+                         __FUNCTION__, __LINE__, __VA_ARGS__)

 static virDomainPtr get_nonnull_domain (virConnectPtr conn, remote_nonnull_domain domain);
 static virNetworkPtr get_nonnull_network (virConnectPtr conn, remote_nonnull_network network);
diff --git a/src/security/security_driver.h b/src/security/security_driver.h
index 15671b3..1b434c4 100644
--- a/src/security/security_driver.h
+++ b/src/security/security_driver.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008 Red Hat, Inc.
+ * Copyright (C) 2008, 2010 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
@@ -88,9 +88,9 @@ int virSecurityDriverStartup(virSecurityDriverPtr *drv,
 int
 virSecurityDriverVerify(virDomainDefPtr def);

-#define virSecurityReportError(code, fmt...)                        \
+#define virSecurityReportError(code, ...)                           \
     virReportErrorHelper(NULL, VIR_FROM_SECURITY, code, __FILE__,   \
-                         __FUNCTION__, __LINE__, fmt)
+                         __FUNCTION__, __LINE__, __VA_ARGS__)

 /* Helpers */
 void virSecurityDriverInit(virSecurityDriverPtr drv);
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index e4720ef..8ee2b6c 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -115,9 +115,9 @@ static const virNodeInfo defaultNodeInfo = {
 };


-#define testError(conn, code, fmt...)                               \
+#define testError(conn, code, ...)                                \
         virReportErrorHelper(conn, VIR_FROM_TEST, code, __FILE__, \
-                               __FUNCTION__, __LINE__, fmt)
+                               __FUNCTION__, __LINE__, __VA_ARGS__)

 static int testClose(virConnectPtr conn);
 static void testDomainEventFlush(int timer, void *opaque);
diff --git a/src/uml/uml_conf.h b/src/uml/uml_conf.h
index c319396..f3967ee 100644
--- a/src/uml/uml_conf.h
+++ b/src/uml/uml_conf.h
@@ -1,7 +1,7 @@
 /*
  * config.h: VM configuration management
  *
- * Copyright (C) 2006, 2007 Red Hat, Inc.
+ * Copyright (C) 2006, 2007, 2010 Red Hat, Inc.
  * Copyright (C) 2006 Daniel P. Berrange
  *
  * This library is free software; you can redistribute it and/or
@@ -62,9 +62,9 @@ struct uml_driver {
 };


-#define umlReportError(conn, dom, net, code, fmt...)                    \
+#define umlReportError(conn, dom, net, code, ...)                       \
     virReportErrorHelper(conn, VIR_FROM_UML, code, __FILE__,            \
-                         __FUNCTION__, __LINE__, fmt)
+                         __FUNCTION__, __LINE__, __VA_ARGS__)

 virCapsPtr  umlCapsInit               (void);

diff --git a/src/vbox/vbox_driver.c b/src/vbox/vbox_driver.c
index ef3eb4b..632cb76 100644
--- a/src/vbox/vbox_driver.c
+++ b/src/vbox/vbox_driver.c
@@ -3,6 +3,7 @@
  */

 /*
+ * Copyright (C) 2010 Red Hat, Inc.
  * Copyright (C) 2008-2009 Sun Microsystems, Inc.
  *
  * This file is part of a free software library; you can redistribute
@@ -57,9 +58,9 @@ static virDriver vboxDriverDummy;

 #define VIR_FROM_THIS VIR_FROM_VBOX

-#define vboxError(conn, code, fmt...) \
+#define vboxError(conn, code, ...) \
         virReportErrorHelper(conn, VIR_FROM_VBOX, code, __FILE__, \
-                            __FUNCTION__, __LINE__, fmt)
+                             __FUNCTION__, __LINE__, __VA_ARGS__)

 int vboxRegister(void) {
     virDriverPtr        driver;
diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c
index c414fb8..ef5a26a 100644
--- a/src/vbox/vbox_tmpl.c
+++ b/src/vbox/vbox_tmpl.c
@@ -8,6 +8,7 @@
  */

 /*
+ * Copyright (C) 2010 Red Hat, Inc.
  * Copyright (C) 2008-2009 Sun Microsystems, Inc.
  *
  * This file is part of a free software library; you can redistribute
@@ -123,9 +124,9 @@ typedef IMediumAttachment IHardDiskAttachment;

 #endif /* VBOX_API_VERSION >= 3001 */

-#define vboxError(conn, code, fmt...) \
+#define vboxError(conn, code, ...) \
         virReportErrorHelper(conn, VIR_FROM_VBOX, code, __FILE__, \
-                            __FUNCTION__, __LINE__, fmt)
+                             __FUNCTION__, __LINE__, __VA_ARGS__)

 #define DEBUGPRUnichar(msg, strUtf16) \
 if (strUtf16) {\
-- 
1.6.6.1




More information about the libvir-list mailing list