]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Efficiently initialise unlang_module_event_t
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Mon, 15 Feb 2021 15:01:24 +0000 (15:01 +0000)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Mon, 15 Feb 2021 15:01:24 +0000 (15:01 +0000)
src/lib/unlang/module.c

index 7388ad4a7dde6841c49cdef043d77bc9104adf00..b5d2daf74d9946c960b2bff875751be13c8be140 100644 (file)
@@ -148,15 +148,17 @@ int unlang_module_timeout_add(request_t *request, unlang_module_timeout_t callba
        fr_assert(frame->instruction->type == UNLANG_TYPE_MODULE);
        mc = unlang_generic_to_module(frame->instruction);
 
-       ev = talloc_zero(request, unlang_module_event_t);
+       ev = talloc(request, unlang_module_event_t);
        if (!ev) return -1;
 
-       ev->request = request;
-       ev->fd = -1;
-       ev->timeout = callback;
-       ev->inst = mc->instance->dl_inst->data;
-       ev->thread = state->thread;
-       ev->ctx = ctx;
+       *ev = (unlang_module_event_t){
+               .request = request,
+               .fd = -1,
+               .timeout = callback,
+               .inst = mc->instance->dl_inst->data,
+               .thread = state->thread,
+               .ctx = ctx
+       };
 
        if (fr_event_timer_at(request, request->el, &ev->ev,
                              when, unlang_module_event_timeout_handler, ev) < 0) {