tevent: Save 32 bytes of .text in tevent_req_create
authorVolker Lendecke <vl@samba.org>
Fri, 22 Jul 2016 14:06:45 +0000 (16:06 +0200)
committerVolker Lendecke <vl@samba.org>
Fri, 22 Jul 2016 17:52:14 +0000 (19:52 +0200)
This is one of or hottest code paths, I think every bit counts here.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
lib/tevent/tevent_req.c

index c86fb68f8013dc4270ad563bbed5b7cb9be12800..2d9cc6db5743bf0f93b1df6b8fc9d6b234b6c0d9 100644 (file)
@@ -69,11 +69,14 @@ struct tevent_req *_tevent_req_create(TALLOC_CTX *mem_ctx,
        if (req == NULL) {
                return NULL;
        }
-       ZERO_STRUCTP(req);
-       req->internal.private_type      = type;
-       req->internal.create_location   = location;
-       req->internal.state             = TEVENT_REQ_IN_PROGRESS;
-       req->internal.trigger           = tevent_create_immediate(req);
+
+       *req = (struct tevent_req) {
+               .internal.private_type          = type,
+               .internal.create_location       = location,
+               .internal.state                 = TEVENT_REQ_IN_PROGRESS,
+               .internal.trigger               = tevent_create_immediate(req)
+       };
+
        if (!req->internal.trigger) {
                talloc_free(req);
                return NULL;