From 62d0ec70eac6ac9c1f26caafaea02c18cbb7eddd Mon Sep 17 00:00:00 2001 From: Michael Richters Date: Fri, 13 Nov 2020 15:13:05 -0600 Subject: [PATCH] Abort hook functions on any result other than `OK` Instead of only aborting hook functions if a handler returns `EVENT_CONSUMED`, only continue abortable hooks if a handler returns `OK`. For existing core plugins, this shouldn't make any difference because none of them use the `ERROR` return value. Also rename `shouldAbortOnConsumedEvent` to better match the new conditional. Signed-off-by: Michael Richters --- src/kaleidoscope_internal/event_dispatch.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/kaleidoscope_internal/event_dispatch.h b/src/kaleidoscope_internal/event_dispatch.h index 5211e86d..747dc270 100644 --- a/src/kaleidoscope_internal/event_dispatch.h +++ b/src/kaleidoscope_internal/event_dispatch.h @@ -80,7 +80,7 @@ #define _REGISTER_EVENT_HANDLER( \ HOOK_NAME, HOOK_VERSION, DEPRECATION_TAG, \ - SHOULD_ABORT_ON_CONSUMED_EVENT, \ + SHOULD_EXIT_IF_RESULT_NOT_OK, \ TMPL_PARAM_TYPE_LIST, TMPL_PARAM_LIST, TMPL_DUMMY_ARGS_LIST, \ SIGNATURE, ARGS_LIST) __NL__ \ __NL__ \ @@ -116,8 +116,8 @@ MAKE_TEMPLATE_SIGNATURE(UNWRAP TMPL_PARAM_TYPE_LIST) __NL__ \ struct _NAME4(EventHandler_, HOOK_NAME, _v, HOOK_VERSION) { __NL__ \ __NL__ \ - static bool shouldAbortOnConsumedEvent() { __NL__ \ - return SHOULD_ABORT_ON_CONSUMED_EVENT; __NL__ \ + static bool shouldExitIfResultNotOk() { __NL__ \ + return SHOULD_EXIT_IF_RESULT_NOT_OK; __NL__ \ } __NL__ \ __NL__ \ template