main: remove CHECK_WAYLAND, inline logic into WRAP
authorMarcus Fritzsch <marcus_fritzsch@mentor.com>
Fri, 7 Jul 2017 06:03:41 +0000 (08:03 +0200)
committerMarcus Fritzsch <marcus_fritzsch@mentor.com>
Tue, 8 Aug 2017 15:24:00 +0000 (17:24 +0200)
Signed-off-by: Marcus Fritzsch <marcus_fritzsch@mentor.com>
src/main.cpp
src/util.hpp

index ed71152..4adf2f8 100644 (file)
@@ -199,15 +199,6 @@ int binding_init() noexcept {
    return -1;
 }
 
-#define CHECK_WAYLAND()                                                    \
-   do {                                                                    \
-      if (g_wayland == nullptr) {                                          \
-         afb_req_fail(req, "failed",                                       \
-                      "Binding not initialized, did the compositor die?"); \
-         return;                                                           \
-      }                                                                    \
-   } while (0)
-
 //      _      _                         _        _              ____
 //   __| | ___| |__  _   _  __ _     ___| |_ __ _| |_ _   _ ___ / /\ \
 //  / _` |/ _ \ '_ \| | | |/ _` |   / __| __/ _` | __| | | / __| |  | |
@@ -238,7 +229,11 @@ void debug_layers(afb_req req) {
 
 #define WRAP(F)                                                             \
    [](afb_req req) noexcept {                                               \
-      CHECK_WAYLAND();                                                      \
+      if (g_wayland == nullptr) {                                           \
+         afb_req_fail(req, "failed",                                        \
+                      "Binding not initialized, did the compositor die?");  \
+         return;                                                            \
+      }                                                                     \
       try {                                                                 \
          F(req);                                                            \
       } catch (std::exception & e) {                                        \
index 253f656..84c2462 100644 (file)
@@ -3,6 +3,7 @@
 
 #include <functional>
 #include <sys/poll.h>
+
 #include <vector>
 
 extern "C" {