smbd: Simplify find_share_mode_entry
authorVolker Lendecke <vl@samba.org>
Tue, 3 Sep 2013 14:38:47 +0000 (14:38 +0000)
committerMichael Adam <obnox@samba.org>
Fri, 6 Sep 2013 11:33:39 +0000 (13:33 +0200)
There's no point checking the validity of the "entry" argument more
than once

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
source3/locking/locking.c

index 5090082ba8b4884be051ebd187d956391901a000..1567f8ffcda1ad3062cd1c884a0ed74ddf78e945 100644 (file)
@@ -751,10 +751,13 @@ static struct share_mode_entry *find_share_mode_entry(struct share_mode_data *d,
 {
        int i;
 
+       if (!is_valid_share_mode_entry(entry)) {
+               return NULL;
+       }
+
        for (i=0; i<d->num_share_modes; i++) {
                struct share_mode_entry *e = &d->share_modes[i];
-               if (is_valid_share_mode_entry(entry) &&
-                   is_valid_share_mode_entry(e) &&
+               if (is_valid_share_mode_entry(e) &&
                    share_modes_identical(e, entry)) {
                        return e;
                }