smbd: Small optimization for break_to_none
authorVolker Lendecke <vl@samba.org>
Tue, 9 Apr 2019 14:34:24 +0000 (16:34 +0200)
committerChristof Schmitt <cs@samba.org>
Sun, 14 Apr 2019 04:01:30 +0000 (04:01 +0000)
We don't need to memzero the struct when we can struct-initialize it a
bit later, implicitly initializing the rest to zero.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
source3/smbd/oplock.c

index 31a36304310fcad786324fad2601ab0d1bd46931..cb471fad1ac568bc641c9c5f4c3da3502585b1b1 100644 (file)
@@ -1192,13 +1192,14 @@ static void contend_level2_oplocks_begin_default(files_struct *fsp,
         * anyway, so we postpone this into an immediate event.
         */
 
-       state = talloc_zero(sconn, struct break_to_none_state);
+       state = talloc(sconn, struct break_to_none_state);
        if (state == NULL) {
                DEBUG(1, ("talloc failed\n"));
                return;
        }
-       state->sconn = sconn;
-       state->id = fsp->file_id;
+       *state = (struct break_to_none_state) {
+               .sconn = sconn, .id = fsp->file_id,
+       };
 
        if (fsp->oplock_type == LEASE_OPLOCK) {
                state->client_guid = *fsp_client_guid(fsp);