[libvirt] [PATCH 3/5] build: consistently use C99 varargs macros in util

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


Continuation of previous patch.

* src/util/hostusb.c (usbReportError): Use C99 rather than GNU
vararg macro syntax.
* src/util/json.c (virJSONError): Likewise.
* src/util/macvtap.c (ReportError): Likewise.
* src/util/pci.c (pciReportError): Likewise.
* src/util/stats_linux.c (virStatsError): Likewise.
* src/util/util.c (virUtilError): Likewise.
* src/util/xml.c (virXMLError): Likewise.
---
 src/util/hostusb.c     |    4 ++--
 src/util/json.c        |    6 +++---
 src/util/macvtap.c     |    5 +++--
 src/util/pci.c         |    4 ++--
 src/util/stats_linux.c |    6 +++---
 src/util/util.c        |    4 ++--
 src/util/xml.c         |    6 +++---
 7 files changed, 18 insertions(+), 17 deletions(-)

diff --git a/src/util/hostusb.c b/src/util/hostusb.c
index bf96539..4f57b59 100644
--- a/src/util/hostusb.c
+++ b/src/util/hostusb.c
@@ -54,9 +54,9 @@ struct _usbDevice {
 /* For virReportOOMError()  and virReportSystemError() */
 #define VIR_FROM_THIS VIR_FROM_NONE

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

 static int usbSysReadFile(const char *f_name, const char *d_name,
                           int base, unsigned *value)
diff --git a/src/util/json.c b/src/util/json.c
index 3abff58..e388287 100644
--- a/src/util/json.c
+++ b/src/util/json.c
@@ -1,8 +1,8 @@
 /*
  * json.c: JSON object parsing/formatting
  *
- * Copyright (C) 2009 Daniel P. Berrange
  * Copyright (C) 2009-2010 Red Hat, Inc.
+ * Copyright (C) 2009 Daniel P. Berrange
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -36,9 +36,9 @@

 /* XXX fixme */
 #define VIR_FROM_THIS VIR_FROM_NONE
-#define virJSONError(code, fmt...)                                      \
+#define virJSONError(code, ...)                                         \
     virReportErrorHelper(NULL, VIR_FROM_NONE, code, __FILE__,           \
-                         __FUNCTION__, __LINE__, fmt)
+                         __FUNCTION__, __LINE__, __VA_ARGS__)


 typedef struct _virJSONParserState virJSONParserState;
diff --git a/src/util/macvtap.c b/src/util/macvtap.c
index 8c29588..3b526ce 100644
--- a/src/util/macvtap.c
+++ b/src/util/macvtap.c
@@ -1,4 +1,5 @@
 /*
+ * Copyright (C) 2010 Red Hat, Inc.
  * Copyright (C) 2010 IBM Corporation
  *
  * This library is free software; you can redistribute it and/or
@@ -48,9 +49,9 @@

 #define VIR_FROM_THIS VIR_FROM_NET

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

 #define MACVTAP_NAME_PREFIX	"macvtap"
 #define MACVTAP_NAME_PATTERN	"macvtap%d"
diff --git a/src/util/pci.c b/src/util/pci.c
index b812241..c6b2072 100644
--- a/src/util/pci.c
+++ b/src/util/pci.c
@@ -75,9 +75,9 @@ struct _pciDeviceList {
 /* For virReportOOMError()  and virReportSystemError() */
 #define VIR_FROM_THIS VIR_FROM_NONE

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

 /* Specifications referenced in comments:
  *  PCI30  - PCI Local Bus Specification 3.0
diff --git a/src/util/stats_linux.c b/src/util/stats_linux.c
index 25f8d08..feb5589 100644
--- a/src/util/stats_linux.c
+++ b/src/util/stats_linux.c
@@ -1,7 +1,7 @@
 /*
  * Linux block and network stats.
  *
- * Copyright (C) 2007-2009 Red Hat, Inc.
+ * Copyright (C) 2007-2010 Red Hat, Inc.
  *
  * See COPYING.LIB for the License of this software
  *
@@ -28,9 +28,9 @@

 #define VIR_FROM_THIS VIR_FROM_STATS_LINUX

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


 /*-------------------- interface stats --------------------*/
diff --git a/src/util/util.c b/src/util/util.c
index cf7bba5..abead4a 100644
--- a/src/util/util.c
+++ b/src/util/util.c
@@ -85,9 +85,9 @@

 #define VIR_FROM_THIS VIR_FROM_NONE

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

 /* Like read(), but restarts after EINTR */
 int saferead(int fd, void *buf, size_t count)
diff --git a/src/util/xml.c b/src/util/xml.c
index 14c8345..9129d78 100644
--- a/src/util/xml.c
+++ b/src/util/xml.c
@@ -1,7 +1,7 @@
 /*
  * xml.c: XML based interfaces for the libvir library
  *
- * Copyright (C) 2005, 2007-2009 Red Hat, Inc.
+ * Copyright (C) 2005, 2007-2010 Red Hat, Inc.
  *
  * See COPYING.LIB for the License of this software
  *
@@ -25,9 +25,9 @@

 #define VIR_FROM_THIS VIR_FROM_XML

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


 /************************************************************************
-- 
1.6.6.1




More information about the libvir-list mailing list