From: Aurelien DARRAGON Date: Mon, 27 Mar 2023 16:16:21 +0000 (+0200) Subject: MINOR: hlua/event_hdl: fix return type for hlua_event_hdl_cb_data_push_args X-Git-Tag: v2.8-dev8~68 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2f6a07dce8d4f86a626e66424c8e58dc85ae9fe4;p=thirdparty%2Fhaproxy.git MINOR: hlua/event_hdl: fix return type for hlua_event_hdl_cb_data_push_args Changing hlua_event_hdl_cb_data_push_args() return type to void since it does not return anything useful. Also changing its name to hlua_event_hdl_cb_push_args() since it does more than just pushing cb data argument (it also handles event type and mgmt). Errors catched by the function are reported as lua errors. --- diff --git a/src/hlua.c b/src/hlua.c index 747e6e8658..a20ab03fad 100644 --- a/src/hlua.c +++ b/src/hlua.c @@ -9029,13 +9029,21 @@ static void hlua_event_handler(struct hlua *hlua) } } -__LJMP static int hlua_event_hdl_cb_data_push_args(struct hlua_event_sub *hlua_sub, - struct event_hdl_sub_type event, void *data) +/* This function pushes various arguments such as event type and event data to + * the lua function that will be called to consume the event. + */ +__LJMP static void hlua_event_hdl_cb_push_args(struct hlua_event_sub *hlua_sub, + struct event_hdl_async_event *e) { struct hlua *hlua = hlua_sub->hlua; + struct event_hdl_sub_type event = e->type; + void *data = e->data; + /* push event type */ hlua->nargs = 1; lua_pushstring(hlua->T, event_hdl_sub_type_to_string(event)); + + /* push event data (according to event type) */ if (event_hdl_sub_family_equal(EVENT_HDL_SUB_SERVER, event)) { struct event_hdl_cb_data_server *e_server = data; struct proxy *px; @@ -9079,8 +9087,6 @@ __LJMP static int hlua_event_hdl_cb_data_push_args(struct hlua_event_sub *hlua_s /* sub mgmt */ hlua->nargs += 1; hlua_fcn_new_event_sub(hlua->T, hlua_sub->sub); - - return 1; } /* events runner: if there's an ongoing hlua event handling process, finish it @@ -9160,10 +9166,7 @@ static struct task *hlua_event_runner(struct task *task, void *context, unsigned /* push args */ hlua_sub->hlua->nargs = 0; - if (!hlua_event_hdl_cb_data_push_args(hlua_sub, event->type, event->data)) { - RESET_SAFE_LJMP(hlua_sub->hlua); - goto skip_event; - } + MAY_LJMP(hlua_event_hdl_cb_push_args(hlua_sub, event)); /* At this point the execution is safe. */ RESET_SAFE_LJMP(hlua_sub->hlua);