CVS update: /ccvs/src/

[email protected] 2 May 2005 19:49:39 -0000
Newsgroups gmane.comp.version-control.cvs.cvs
Message-ID <[email protected]>
User: dprice  
Date: 05/05/02 12:49:39

Modified:
 /ccvs/src/
  ChangeLog, lock.c

Log:
 Merge changes from 1.11.x.

File Changes:

Directory: /ccvs/src/
=====================

File [changed]: ChangeLog
Url: https://ccvs.cvshome.org/source/browse/ccvs/src/ChangeLog?r1=1.3182&r2=1.3183
Delta lines:  +13 -0
--------------------
--- ChangeLog	2 May 2005 19:16:35 -0000	1.3182
+++ ChangeLog	2 May 2005 19:49:36 -0000	1.3183
@@ -1,5 +1,18 @@
 2005-05-02  Derek Price  <[email protected]>
 
+	Remove unnecessary level of indirection.
+	* lock.c (L_HISTORY_LOCK, L_VAL_TAGS_LOCK): Remove macros.
+	(internal_lock, internal_clear_lock): Accept lock as argument.
+	(history_lock, clear_history_lock, val_tags_lock, clear_val_tags_lock):
+	Replace old macro arg with an actual lock pointer.
+
+2005-05-02  Derek Price  <[email protected]>
+
+	* lock.c (internal_lock, internal_clear_lock): Add protos.
+	(history_lock, val_tags_lock): Return the chartered true/false status.
+
+2005-05-02  Derek Price  <[email protected]>
+
 	* cvs.h (CVSHISTLCK): Rename macro to...
 	(CVSHISTORYLCK): ...this.
 	(CVSVALTAGSLCK): New macro.

File [changed]: lock.c
Url: https://ccvs.cvshome.org/source/browse/ccvs/src/lock.c?r1=1.115&r2=1.116
Delta lines:  +3 -22
--------------------
--- lock.c	2 May 2005 19:16:36 -0000	1.115
+++ lock.c	2 May 2005 19:49:36 -0000	1.116
@@ -1304,9 +1304,6 @@
 
 
 
-#define L_HISTORY_LOCK	1
-#define L_VAL_TAGS_LOCK	2
-
 /* This is the internal implementation behind history_lock & val_tags_lock.  It
  * gets a write lock for the history or val-tags file.
  *
@@ -1315,24 +1312,8 @@
  *   false, on error
  */
 static inline int
-internal_lock (const char *xrepository, int type)
+internal_lock (struct lock *lock, const char *xrepository)
 {
-    struct lock *lock;
-
-    switch (type)
-    {
-	case L_HISTORY_LOCK:
-	    lock = &global_history_lock;
-	    break;
-
-	case L_VAL_TAGS_LOCK:
-	    lock = &global_val_tags_lock;
-	    break;
-
-	default:
-	    error (1, 0, "internal error: unknown lock type requested");
-    }
-
     /* remember what we're locking (for Lock_Cleanup) */
     assert (!lock->repository);
     lock->repository = Xasprintf ("%s/%s", xrepository, CVSROOTADM);
@@ -1358,7 +1339,7 @@
 int
 history_lock (const char *xrepository)
 {
-    return internal_lock (xrepository, L_HISTORY_LOCK);
+    return internal_lock (&global_history_lock, xrepository);
 }
 
 
@@ -1378,7 +1359,7 @@
 int
 val_tags_lock (const char *xrepository)
 {
-    return internal_lock (xrepository, L_VAL_TAGS_LOCK);
+    return internal_lock (&global_val_tags_lock, xrepository);
 }