From ba1234d877b3364be3b2f6793e3a6fe6c238da0f Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Fri, 6 Sep 2019 11:30:23 +0200 Subject: [PATCH] smbd: Introduce helper variables in open_mode_check() Less bytes .text, the compiler now does not have to expect other threads to alter the pointers. Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison --- source3/smbd/open.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/source3/smbd/open.c b/source3/smbd/open.c index e6a1c8327e9..5e827cecc93 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -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; } -- 2.47.3