svn commit: samba r16928 - in trunk/source/locking: .

jra at samba.org jra at samba.org
Mon Jul 10 21:33:53 GMT 2006


Author: jra
Date: 2006-07-10 21:33:52 +0000 (Mon, 10 Jul 2006)
New Revision: 16928

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=16928

Log:
Fix the ZERO_ZERO case back to working again. Fix compiler
warning pointed out by Volker (thanks!).
Jeremy.

Modified:
   trunk/source/locking/brlock.c


Changeset:
Modified: trunk/source/locking/brlock.c
===================================================================
--- trunk/source/locking/brlock.c	2006-07-10 20:40:42 UTC (rev 16927)
+++ trunk/source/locking/brlock.c	2006-07-10 21:33:52 UTC (rev 16928)
@@ -740,9 +740,12 @@
 	unsigned int i, j;
 	struct lock_struct *lock = NULL;
 	struct lock_struct *locks = (struct lock_struct *)br_lck->lock_data;
-	enum brl_type deleted_lock_type;
+	enum brl_type deleted_lock_type = READ_LOCK; /* shut the compiler up.... */
 
 #if ZERO_ZERO
+	/* Delete write locks by preference... The lock list
+	   is sorted in the zero zero case. */
+
 	for (i = 0; i < br_lck->num_locks; i++) {
 		lock = &locks[i];
 
@@ -755,17 +758,14 @@
 
 			/* found it - delete it */
 			deleted_lock_type = lock->lock_type;
-
-			if (i < br_lck->num_locks - 1) {
-				memmove(&locks[i], &locks[i+1], 
-					sizeof(*locks)*((br_lck->num_locks-1) - i));
-			}
-
-			br_lck->num_locks -= 1;
-			br_lck->modified = True;
-			return True;
+			break;
 		}
 	}
+
+	if (i != br_lck->num_locks) {
+		/* We found it - don't search again. */
+		goto unlock_continue;
+	}
 #endif
 
 	for (i = 0; i < br_lck->num_locks; i++) {
@@ -787,6 +787,10 @@
 		return False;
 	}
 
+#if ZERO_ZERO
+  unlock_continue:
+#endif
+
 	/* Actually delete the lock. */
 	if (i < br_lck->num_locks - 1) {
 		memmove(&locks[i], &locks[i+1], 



More information about the samba-cvs mailing list