]> git.samba.org - amitay/samba.git/commitdiff
smbd: Use ARRAY_DEL_ELEMENT() in brl_unlock_windows_default()
authorVolker Lendecke <vl@samba.org>
Wed, 25 Mar 2020 21:37:34 +0000 (22:37 +0100)
committerRalph Boehme <slow@samba.org>
Thu, 26 Mar 2020 14:43:31 +0000 (14:43 +0000)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/locking/brlock.c

index c0ff99a21c5bf04355f59cc6bd30c5d4ec359ee7..68ade6b6d591af725203fbbfcccf1c6b3cea308d 100644 (file)
@@ -1035,17 +1035,6 @@ NTSTATUS brl_lock(
        return ret;
 }
 
-static void brl_delete_lock_struct(struct lock_struct *locks,
-                                  unsigned num_locks,
-                                  unsigned del_idx)
-{
-       if (del_idx >= num_locks) {
-               return;
-       }
-       memmove(&locks[del_idx], &locks[del_idx+1],
-               sizeof(*locks) * (num_locks - del_idx - 1));
-}
-
 /****************************************************************************
  Unlock a range of bytes - Windows semantics.
 ****************************************************************************/
@@ -1108,7 +1097,7 @@ bool brl_unlock_windows_default(struct byte_range_lock *br_lck,
   unlock_continue:
 #endif
 
-       brl_delete_lock_struct(locks, br_lck->num_locks, i);
+       ARRAY_DEL_ELEMENT(locks, i, br_lck->num_locks);
        br_lck->num_locks -= 1;
        br_lck->modified = True;