smbd: Introduce helper variables in open_mode_check()
authorVolker Lendecke <vl@samba.org>
Fri, 6 Sep 2019 09:30:23 +0000 (11:30 +0200)
committerJeremy Allison <jra@samba.org>
Tue, 17 Sep 2019 22:49:36 +0000 (22:49 +0000)
Less bytes .text, the compiler now does not have to expect other threads to
alter the pointers.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/smbd/open.c

index e6a1c8327e9f00a2a5b50818486593bdbe0daaa5..5e827cecc930d48614bbc3212ab094ba5d987c8c 100644 (file)
@@ -1647,6 +1647,7 @@ static NTSTATUS open_mode_check(connection_struct *conn,
                                uint32_t access_mask,
                                uint32_t share_access)
 {
+       struct share_mode_data *d = lck->data;
        uint32_t i;
 
        if (is_stat_open(access_mask)) {
@@ -1660,24 +1661,24 @@ static NTSTATUS open_mode_check(connection_struct *conn,
         */
 
 #if defined(DEVELOPER)
-       for(i = 0; i < lck->data->num_share_modes; i++) {
-               validate_my_share_entries(conn->sconn, lck->data->id, i,
-                                         &lck->data->share_modes[i]);
+       for(i = 0; i < d->num_share_modes; i++) {
+               validate_my_share_entries(
+                       conn->sconn, d->id, i, &d->share_modes[i]);
        }
 #endif
 
-       for(i = 0; i < lck->data->num_share_modes; i++) {
+       for(i = 0; i < d->num_share_modes; i++) {
+               struct share_mode_entry *e = &d->share_modes[i];
 
-               if (!is_valid_share_mode_entry(&lck->data->share_modes[i])) {
+               if (!is_valid_share_mode_entry(e)) {
                        continue;
                }
 
                /* someone else has a share lock on it, check to see if we can
                 * too */
-               if (share_conflict(&lck->data->share_modes[i],
-                                  access_mask, share_access)) {
+               if (share_conflict(e, access_mask, share_access)) {
 
-                       if (share_mode_stale_pid(lck->data, i)) {
+                       if (share_mode_stale_pid(d, i)) {
                                continue;
                        }