Re: [PATCH 03/13] vbox: Rewrite vboxConnectNumOfNetworks

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 20.08.2014 02:17, Taowei wrote:
---
  src/vbox/vbox_common.c        |   46 +++++++++++++++++++++++++++++
  src/vbox/vbox_common.h        |   15 ++++++++++
  src/vbox/vbox_tmpl.c          |   65 ++++++++++++++++++++---------------------
  src/vbox/vbox_uniformed_api.h |   10 +++++++
  4 files changed, 102 insertions(+), 34 deletions(-)

diff --git a/src/vbox/vbox_common.c b/src/vbox/vbox_common.c
index 4f11b7d..7aeb3b9 100644
--- a/src/vbox/vbox_common.c
+++ b/src/vbox/vbox_common.c
@@ -104,6 +104,17 @@ type ret = value;\
  if (!data->vboxObj) {\
      return ret;\
  }
+#define VBOX_OBJECT_HOST_CHECK(conn, type, value) \
+vboxGlobalData *data = conn->privateData;\
+type ret = value;\
+IHost *host = NULL;\
+if (!data->vboxObj) {\
+    return ret;\
+}\

This is rather unusual macro. I'd expect any CHECK macro just to check if given condition is true. Of course for that purpose it can declare local variables, but they had to be disclosed in do { } while(0) block to prevent namespace pollution.

I know you're just copying preexisting code. But the code we currently have is wrong in many ways. So I guess we can fix this now. I'd just drop the macros for good. I don't find them useful anyway.

Michal

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]