From fb23819615c01837dd7bfd9d79e541603f0d2240 Mon Sep 17 00:00:00 2001 From: Peter Johanson Date: Sun, 14 Jan 2024 23:49:51 +0000 Subject: [PATCH] fix(events): Remove our usage of assert. * __ASSERT is converted to a do/while loop when asserts are enabled, which doesn't work with our usage, so revert that addition. --- app/include/zmk/event_manager.h | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/app/include/zmk/event_manager.h b/app/include/zmk/event_manager.h index 6213db16a8b..e44207152d3 100644 --- a/app/include/zmk/event_manager.h +++ b/app/include/zmk/event_manager.h @@ -71,19 +71,14 @@ struct zmk_event_subscription { .listener = &zmk_listener_##mod, \ }; -#define ZMK_ASSERT_EVENT_LIKE(ev) \ - (__ASSERT((uint8_t *)&(ev).header - (uint8_t *)&ev == 0, \ - "header must be first element of event")) - -#define ZMK_EVENT_RAISE(ev) (ZMK_ASSERT_EVENT_LIKE(ev), zmk_event_manager_raise(&(ev).header)) +#define ZMK_EVENT_RAISE(ev) zmk_event_manager_raise(&(ev).header) #define ZMK_EVENT_RAISE_AFTER(ev, mod) \ - (ZMK_ASSERT_EVENT_LIKE(ev), zmk_event_manager_raise_after(&(ev).header, &zmk_listener_##mod)) + zmk_event_manager_raise_after(&(ev).header, &zmk_listener_##mod) -#define ZMK_EVENT_RAISE_AT(ev, mod) \ - (ZMK_ASSERT_EVENT_LIKE(ev), zmk_event_manager_raise_at(&(ev).header, &zmk_listener_##mod)) +#define ZMK_EVENT_RAISE_AT(ev, mod) zmk_event_manager_raise_at(&(ev).header, &zmk_listener_##mod) -#define ZMK_EVENT_RELEASE(ev) (ZMK_ASSERT_EVENT_LIKE(ev), zmk_event_manager_release(&(ev).header)) +#define ZMK_EVENT_RELEASE(ev) zmk_event_manager_release(&(ev).header) int zmk_event_manager_raise(zmk_event_t *event); int zmk_event_manager_raise_after(zmk_event_t *event, const struct zmk_listener *listener);