Currently the DEBUG and DEBUG0 macros are duplicated in
every file that uses them. This patch moves the macros
to internal.h, removes the needless duplication, and
now every file gets them for free. Seems to work as
expected in my testing.

Thanks,
Cole
commit 1a19564d054f3903201a7c65ff0f46c6b169f9c3
Author: Cole Robinson <[EMAIL PROTECTED]>
Date:   Thu Oct 2 11:18:00 2008 -0400

    Move debug macros to internal.h, rather than duplicate everywhere.

diff --git a/qemud/remote.c b/qemud/remote.c
index 3e43dcf..8acd95d 100644
--- a/qemud/remote.c
+++ b/qemud/remote.c
@@ -52,8 +52,6 @@
 #include "qemud.h"
 #include "memory.h"
 
-#define DEBUG 0
-
 #define REMOTE_DEBUG(fmt,...) qemudDebug("REMOTE: " fmt, __VA_ARGS__)
 
 static void remoteDispatchError (struct qemud_client *client,
@@ -427,10 +425,6 @@ remoteDispatchOpen (struct qemud_server *server ATTRIBUTE_UNUSED,
 
     name = args->name ? *args->name : NULL;
 
-#if DEBUG
-    fprintf (stderr, "remoteDispatchOpen: name = %s\n", name);
-#endif
-
     /* If this connection arrived on a readonly socket, force
      * the connection to be readonly.
      */
diff --git a/src/hash.c b/src/hash.c
index 01def44..d4b8a74 100644
--- a/src/hash.c
+++ b/src/hash.c
@@ -29,9 +29,6 @@
 
 #define MAX_HASH_LEN 8
 
-#define DEBUG(fmt,...) VIR_DEBUG(__FILE__, fmt, __VA_ARGS__)
-#define DEBUG0(msg) VIR_DEBUG(__FILE__, "%s", msg)
-
 /* #define DEBUG_GROW */
 
 /*
diff --git a/src/internal.h b/src/internal.h
index d96504d..a3d48fa 100644
--- a/src/internal.h
+++ b/src/internal.h
@@ -85,6 +85,9 @@ extern int debugFlag;
     do { } while (0)
 #endif /* !ENABLE_DEBUG */
 
+#define DEBUG(fmt,...) VIR_DEBUG(__FILE__, fmt, __VA_ARGS__)
+#define DEBUG0(msg) VIR_DEBUG(__FILE__, "%s", msg)
+
 /* C99 uses __func__.  __FUNCTION__ is legacy. */
 #ifndef __GNUC__
 #define __FUNCTION__ __func__
diff --git a/src/libvirt.c b/src/libvirt.c
index ed98323..e06e9f3 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -76,9 +76,6 @@ static int virStateDriverTabCount = 0;
 #endif
 static int initialized = 0;
 
-#define DEBUG(fmt,...) VIR_DEBUG(__FILE__, fmt, __VA_ARGS__)
-#define DEBUG0(msg) VIR_DEBUG(__FILE__, "%s", msg)
-
 #ifdef ENABLE_DEBUG
 int debugFlag = 0;
 #endif
diff --git a/src/lxc_conf.c b/src/lxc_conf.c
index 4228b86..bea6bbe 100644
--- a/src/lxc_conf.c
+++ b/src/lxc_conf.c
@@ -29,10 +29,6 @@
 
 #include "lxc_conf.h"
 
-/* debug macros */
-#define DEBUG(fmt,...) VIR_DEBUG(__FILE__, fmt, __VA_ARGS__)
-#define DEBUG0(msg) VIR_DEBUG(__FILE__, "%s", msg)
-
 /* Functions */
 void lxcError(virConnectPtr conn, virDomainPtr dom, int code,
               const char *fmt, ...)
diff --git a/src/lxc_container.c b/src/lxc_container.c
index 0e3c049..3759f6e 100644
--- a/src/lxc_container.c
+++ b/src/lxc_container.c
@@ -46,9 +46,6 @@
 #include "memory.h"
 #include "veth.h"
 
-#define DEBUG(fmt,...) VIR_DEBUG(__FILE__, fmt, __VA_ARGS__)
-#define DEBUG0(msg) VIR_DEBUG(__FILE__, "%s", msg)
-
 /*
  * GLibc headers are behind the kernel, so we define these
  * constants if they're not present already.
diff --git a/src/lxc_controller.c b/src/lxc_controller.c
index 7927051..83efdf7 100644
--- a/src/lxc_controller.c
+++ b/src/lxc_controller.c
@@ -43,10 +43,6 @@
 #include "memory.h"
 #include "util.h"
 
-
-#define DEBUG(fmt,...) VIR_DEBUG(__FILE__, fmt, __VA_ARGS__)
-#define DEBUG0(msg) VIR_DEBUG(__FILE__, "%s", msg)
-
 int debugFlag = 0;
 
 static char*lxcMonitorPath(virDomainDefPtr def)
diff --git a/src/lxc_driver.c b/src/lxc_driver.c
index 9dfe418..d0f560a 100644
--- a/src/lxc_driver.c
+++ b/src/lxc_driver.c
@@ -45,11 +45,6 @@
 #include "event.h"
 
 
-/* debug macros */
-#define DEBUG(fmt,...) VIR_DEBUG(__FILE__, fmt, __VA_ARGS__)
-#define DEBUG0(msg) VIR_DEBUG(__FILE__, "%s", msg)
-
-
 static int lxcStartup(void);
 static int lxcShutdown(void);
 static lxc_driver_t *lxc_driver = NULL;
diff --git a/src/remote_internal.c b/src/remote_internal.c
index 66de9d5..ec745d6 100644
--- a/src/remote_internal.c
+++ b/src/remote_internal.c
@@ -74,9 +74,6 @@
 #include "memory.h"
 #include "util.h"
 
-#define DEBUG(fmt,...) VIR_DEBUG(__FILE__, fmt,__VA_ARGS__)
-#define DEBUG0(msg) VIR_DEBUG(__FILE__, "%s", msg)
-
 /* Per-connection private data. */
 #define MAGIC 999               /* private_data->magic if OK */
 #define DEAD 998                /* private_data->magic if dead/closed */
diff --git a/src/storage_backend_disk.c b/src/storage_backend_disk.c
index ea6d720..e9c9446 100644
--- a/src/storage_backend_disk.c
+++ b/src/storage_backend_disk.c
@@ -30,9 +30,6 @@
 #include "util.h"
 #include "memory.h"
 
-#define DEBUG(fmt,...) VIR_DEBUG(__FILE__, fmt, __VA_ARGS__)
-#define DEBUG0(msg) VIR_DEBUG(__FILE__, "%s", msg)
-
 enum {
     VIR_STORAGE_POOL_DISK_DOS = 0,
     VIR_STORAGE_POOL_DISK_DVH,
diff --git a/src/veth.c b/src/veth.c
index 7cfee56..e2dcb95 100644
--- a/src/veth.c
+++ b/src/veth.c
@@ -18,9 +18,6 @@
 #include "memory.h"
 #include "util.h"
 
-#define DEBUG(fmt,...) VIR_DEBUG(__FILE__, fmt, __VA_ARGS__)
-#define DEBUG0(msg) VIR_DEBUG(__FILE__, "%s", msg)
-
 /* Functions */
 /**
  * getFreeVethName:
diff --git a/src/xen_internal.c b/src/xen_internal.c
index 3cfc5e3..c3aaa60 100644
--- a/src/xen_internal.c
+++ b/src/xen_internal.c
@@ -48,9 +48,6 @@
 #include "capabilities.h"
 #include "memory.h"
 
-#define DEBUG(fmt,...) VIR_DEBUG(__FILE__, fmt, __VA_ARGS__)
-#define DEBUG0(msg) VIR_DEBUG(__FILE__, "%s", msg)
-
 /*
  * so far there is 2 versions of the structures usable for doing
  * hypervisor calls.
diff --git a/src/xen_unified.c b/src/xen_unified.c
index 5807391..dae68d3 100644
--- a/src/xen_unified.c
+++ b/src/xen_unified.c
@@ -40,9 +40,6 @@
 #include "util.h"
 #include "memory.h"
 
-#define DEBUG(fmt,...) VIR_DEBUG(__FILE__, fmt,__VA_ARGS__)
-#define DEBUG0(msg) VIR_DEBUG(__FILE__, "%s", msg)
-
 static int
 xenUnifiedNodeGetInfo (virConnectPtr conn, virNodeInfoPtr info);
 static int
diff --git a/src/xend_internal.c b/src/xend_internal.c
index d6dcd3e..0125913 100644
--- a/src/xend_internal.c
+++ b/src/xend_internal.c
@@ -46,9 +46,6 @@
 /* required for cpumap_t */
 #include <xen/dom0_ops.h>
 
-#define DEBUG(fmt,...) VIR_DEBUG(__FILE__, fmt,__VA_ARGS__)
-#define DEBUG0(msg) VIR_DEBUG(__FILE__, "%s", msg)
-
 #ifndef PROXY
 
 /*
--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to