summaryrefslogtreecommitdiff
path: root/src/utils.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils.h')
-rw-r--r--src/utils.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/utils.h b/src/utils.h
index a89f498..5f9d1cb 100644
--- a/src/utils.h
+++ b/src/utils.h
@@ -4,10 +4,8 @@
#include <cstdlib>
#include <stdint.h>
-extern "C" {
#include "xdg-shell.h"
#include <wayland-client.h>
-}
typedef uint8_t u8;
typedef uint16_t u16;
@@ -28,6 +26,8 @@ typedef struct xdg_wm_base *xdg_wm_base_t;
typedef struct xdg_surface *xdg_surface_t;
typedef struct xdg_toplevel *xdg_toplevel_t;
+static inline u32 wayc_min(u32 a, u32 b) { return a > b ? a : b; }
+
[[noreturn]] static inline void wayc_panic_impl(const char *file, int line,
const char *func,
const char *fmt, ...) {
@@ -40,7 +40,7 @@ typedef struct xdg_toplevel *xdg_toplevel_t;
exit(EXIT_FAILURE);
}
-#define wayc_panic(...) \
+#define wayc_panic(...) \
wayc_panic_impl(__FILE__, __LINE__, __func__, __VA_ARGS__)
#define wayc_assert(expr) \
@@ -48,3 +48,5 @@ typedef struct xdg_toplevel *xdg_toplevel_t;
if (!(expr)) \
wayc_panic("Assertion failed: %s", #expr); \
} while (0)
+
+#define wayc_notnull(expr) wayc_assert(expr != NULL)