From 68e72f9275401c3cb7541259c692a704cbfc5e82 Mon Sep 17 00:00:00 2001 From: Pete Johanson Date: Wed, 9 Sep 2020 23:57:44 -0400 Subject: fix: Switch to single AUTHORS file.* Closes #164 --- app/src/event_manager.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/src/event_manager.c') diff --git a/app/src/event_manager.c b/app/src/event_manager.c index 47ad6b7..6d37e4e 100644 --- a/app/src/event_manager.c +++ b/app/src/event_manager.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 Peter Johanson + * Copyright (c) 2020 The ZMK Contributors * * SPDX-License-Identifier: MIT */ -- cgit v1.2.3 From 191a2d755ad4761bd04a30a113e05119ad7aa61e Mon Sep 17 00:00:00 2001 From: Pete Johanson Date: Sun, 13 Sep 2020 22:53:24 -0400 Subject: chore: clang-format the codebase. * Use the LLVM style * Override indent width (8) and column limit (100) * Fixes #142. --- app/src/event_manager.c | 44 ++++++++++++++++++++------------------------ 1 file changed, 20 insertions(+), 24 deletions(-) (limited to 'app/src/event_manager.c') diff --git a/app/src/event_manager.c b/app/src/event_manager.c index 6d37e4e..226f3ce 100644 --- a/app/src/event_manager.c +++ b/app/src/event_manager.c @@ -3,7 +3,7 @@ * * SPDX-License-Identifier: MIT */ - + #include #include @@ -11,15 +11,13 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL); #include -extern struct zmk_event_type* __event_type_start[]; -extern struct zmk_event_type* __event_type_end[]; +extern struct zmk_event_type *__event_type_start[]; +extern struct zmk_event_type *__event_type_end[]; extern struct zmk_event_subscription __event_subscriptions_start[]; extern struct zmk_event_subscription __event_subscriptions_end[]; - -int zmk_event_manager_handle_from(struct zmk_event_header *event, u8_t start_index) -{ +int zmk_event_manager_handle_from(struct zmk_event_header *event, u8_t start_index) { int ret = 0; u8_t len = __event_subscriptions_end - __event_subscriptions_start; for (int i = start_index; i < len; i++) { @@ -31,15 +29,15 @@ int zmk_event_manager_handle_from(struct zmk_event_header *event, u8_t start_ind goto release; } else if (ret > 0) { switch (ret) { - case ZMK_EV_EVENT_HANDLED: - LOG_DBG("Listener handled the event"); - ret = 0; - goto release; - case ZMK_EV_EVENT_CAPTURED: - LOG_DBG("Listener captured the event"); - event->last_listener_index = i; - // Listeners are expected to free events they capture - return 0; + case ZMK_EV_EVENT_HANDLED: + LOG_DBG("Listener handled the event"); + ret = 0; + goto release; + case ZMK_EV_EVENT_CAPTURED: + LOG_DBG("Listener captured the event"); + event->last_listener_index = i; + // Listeners are expected to free events they capture + return 0; } } } @@ -50,19 +48,18 @@ release: return ret; } -int zmk_event_manager_raise(struct zmk_event_header *event) -{ +int zmk_event_manager_raise(struct zmk_event_header *event) { return zmk_event_manager_handle_from(event, 0); } -int zmk_event_manager_raise_after(struct zmk_event_header *event, const struct zmk_listener *listener) -{ +int zmk_event_manager_raise_after(struct zmk_event_header *event, + const struct zmk_listener *listener) { u8_t len = __event_subscriptions_end - __event_subscriptions_start; for (int i = 0; i < len; i++) { struct zmk_event_subscription *ev_sub = __event_subscriptions_start + i; if (ev_sub->event_type == event->event && ev_sub->listener == listener) { - return zmk_event_manager_handle_from(event, i+1); + return zmk_event_manager_handle_from(event, i + 1); } } @@ -71,8 +68,8 @@ int zmk_event_manager_raise_after(struct zmk_event_header *event, const struct z return -EINVAL; } -int zmk_event_manager_raise_at(struct zmk_event_header *event, const struct zmk_listener *listener) -{ +int zmk_event_manager_raise_at(struct zmk_event_header *event, + const struct zmk_listener *listener) { u8_t len = __event_subscriptions_end - __event_subscriptions_start; for (int i = 0; i < len; i++) { struct zmk_event_subscription *ev_sub = __event_subscriptions_start + i; @@ -87,7 +84,6 @@ int zmk_event_manager_raise_at(struct zmk_event_header *event, const struct zmk_ return -EINVAL; } -int zmk_event_manager_release(struct zmk_event_header *event) -{ +int zmk_event_manager_release(struct zmk_event_header *event) { return zmk_event_manager_handle_from(event, event->last_listener_index + 1); } -- cgit v1.2.3