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

[Xen-changelog] [xen-unstable] libxl: Fix incorrect return of OSEVENT_HOOK macro


  • To: xen-changelog@xxxxxxxxxxxxxxxxxxx
  • From: Xen patchbot-unstable <patchbot@xxxxxxx>
  • Date: Mon, 14 May 2012 16:32:20 +0000
  • Delivery-date: Mon, 14 May 2012 16:32:31 +0000
  • List-id: "Change log for Mercurial \(receive only\)" <xen-changelog.lists.xen.org>

# HG changeset patch
# User Daniel De Graaf <dgdegra@xxxxxxxxxxxxx>
# Date 1336648755 -3600
# Node ID fd2a63f58481c495dce41584e289a64e1bc04efc
# Parent  ba9fc0cb26b7104cdb85b3e5563253c2d949a90a
libxl: Fix incorrect return of OSEVENT_HOOK macro

The OSEVENT_HOOK_INTERN macro incorrectly returned the value of the
expression CTX->osevent_in_hook-- (usually 1) instead of the value of
the function call it made. Fix the macro to return the proper value.

Signed-off-by: Daniel De Graaf <dgdegra@xxxxxxxxxxxxx>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---


diff -r ba9fc0cb26b7 -r fd2a63f58481 tools/libxl/libxl_event.c
--- a/tools/libxl/libxl_event.c Mon May 07 17:54:08 2012 +0200
+++ b/tools/libxl/libxl_event.c Thu May 10 12:19:15 2012 +0100
@@ -27,18 +27,22 @@
  * these macros, with the ctx locked.  Likewise all the "occurred"
  * entrypoints from the application should assert(!in_hook);
  */
-#define OSEVENT_HOOK_INTERN(defval, hookname, ...)                      \
-    (CTX->osevent_hooks                                                 \
-     ? (CTX->osevent_in_hook++,                                         \
-        CTX->osevent_hooks->hookname(CTX->osevent_user, __VA_ARGS__),   \
-        CTX->osevent_in_hook--)                                         \
-     : defval)
+#define OSEVENT_HOOK_INTERN(retval, hookname, ...) do {                      \
+    if (CTX->osevent_hooks) {                                                \
+        CTX->osevent_in_hook++;                                              \
+        retval CTX->osevent_hooks->hookname(CTX->osevent_user, __VA_ARGS__); \
+        CTX->osevent_in_hook--;                                              \
+    }                                                                        \
+} while (0)
 
-#define OSEVENT_HOOK(hookname,...)                      \
-    OSEVENT_HOOK_INTERN(0, hookname, __VA_ARGS__)
+#define OSEVENT_HOOK(hookname, ...) ({                                       \
+    int osevent_hook_rc = 0;                                                 \
+    OSEVENT_HOOK_INTERN(osevent_hook_rc = , hookname, __VA_ARGS__);          \
+    osevent_hook_rc;                                                         \
+})
 
-#define OSEVENT_HOOK_VOID(hookname,...)                 \
-    OSEVENT_HOOK_INTERN((void)0, hookname, __VA_ARGS__)
+#define OSEVENT_HOOK_VOID(hookname, ...) \
+    OSEVENT_HOOK_INTERN(/* void */, hookname, __VA_ARGS__)
 
 /*
  * fd events

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.