tevent: use struct initializers for tevent_signal
authorStefan Metzmacher <metze@samba.org>
Thu, 23 Oct 2014 05:15:14 +0000 (07:15 +0200)
committerStefan Metzmacher <metze@samba.org>
Thu, 17 May 2018 07:51:46 +0000 (09:51 +0200)
Signed-off-by: Stefan Metzmacher <metze@samba.org>
lib/tevent/tevent_signal.c

index c85e1c528c4ef3579fa006e5bd9a42c027ddaf1c..1283aab4821159704150469e04bbde73be095f1f 100644 (file)
@@ -257,22 +257,23 @@ struct tevent_signal *tevent_common_add_signal(struct tevent_context *ev,
        se = talloc(mem_ctx?mem_ctx:ev, struct tevent_signal);
        if (se == NULL) return NULL;
 
-       se->event_ctx           = ev;
-       se->signum              = signum;
-       se->sa_flags            = sa_flags;
-       se->handler             = handler;
-       se->private_data        = private_data;
-       se->handler_name        = handler_name;
-       se->location            = location;
-       se->additional_data     = NULL;
-
        sl = talloc(se, struct tevent_common_signal_list);
        if (!sl) {
                talloc_free(se);
                return NULL;
        }
        sl->se = se;
-       se->additional_data     = sl;
+
+       *se = (struct tevent_signal) {
+               .event_ctx      = ev,
+               .signum         = signum,
+               .sa_flags       = sa_flags,
+               .handler        = handler,
+               .private_data   = private_data,
+               .handler_name   = handler_name,
+               .location       = location,
+               .additional_data= sl,
+       };
 
        /* Ensure, no matter the destruction order, that we always have a handle on the global sig_state */
        if (!talloc_reference(se, sig_state)) {