CVS update [cvs1-11-x-branch]: /ccvs/src/
[email protected] 2 May 2005 19:39:12 -0000
| Newsgroups | gmane.comp.version-control.cvs.cvs |
|---|---|
| Message-ID | <[email protected]> |
Tag: cvs1-11-x-branch User: dprice Date: 05/05/02 12:39:12 Modified: /ccvs/src/ ChangeLog, lock.c Log: 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. File Changes: Directory: /ccvs/src/ ===================== File [changed]: ChangeLog Url: https://ccvs.cvshome.org/source/browse/ccvs/src/ChangeLog?r1=1.2336.2.370&r2=1.2336.2.371 Delta lines: +8 -0 ------------------- --- ChangeLog 2 May 2005 18:20:50 -0000 1.2336.2.370 +++ ChangeLog 2 May 2005 19:39:10 -0000 1.2336.2.371 @@ -1,5 +1,13 @@ 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. File [changed]: lock.c Url: https://ccvs.cvshome.org/source/browse/ccvs/src/lock.c?r1=1.59.4.16&r2=1.59.4.17 Delta lines: +10 -45 --------------------- --- lock.c 2 May 2005 17:41:59 -0000 1.59.4.16 +++ lock.c 2 May 2005 19:39:10 -0000 1.59.4.17 @@ -1061,9 +1061,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. * @@ -1071,28 +1068,12 @@ * true, on success * false, on error */ -static int internal_lock PROTO ((const char *xrepository, int type)); +static int internal_lock PROTO ((struct lock *lock, const char *xrepository)); static int -internal_lock (xrepository, type) +internal_lock (lock, xrepository) + struct lock *lock; const char *xrepository; - int type; { - 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 = xmalloc (strlen (xrepository) + sizeof (CVSROOTADM) + 2); @@ -1116,27 +1097,11 @@ /* This is the internal implementation behind history_lock & val_tags_lock. It * removes the write lock for the history or val-tags file, when it exists. */ -static void internal_clear_lock PROTO((int type)); +static void internal_clear_lock PROTO((struct lock *lock)); static void -internal_clear_lock (type) - int type; -{ +internal_clear_lock (lock) 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"); - } - +{ SIG_beginCrSect (); if (lock->repository) { @@ -1156,7 +1121,7 @@ history_lock (xrepository) const char *xrepository; { - return internal_lock (xrepository, L_HISTORY_LOCK); + return internal_lock (&global_history_lock, xrepository); } @@ -1166,7 +1131,7 @@ void clear_history_lock () { - internal_clear_lock (L_HISTORY_LOCK); + internal_clear_lock (&global_history_lock); } @@ -1177,7 +1142,7 @@ val_tags_lock (xrepository) const char *xrepository; { - return internal_lock (xrepository, L_VAL_TAGS_LOCK); + return internal_lock (&global_val_tags_lock, xrepository); } @@ -1187,5 +1152,5 @@ void clear_val_tags_lock () { - internal_clear_lock (L_VAL_TAGS_LOCK); + internal_clear_lock (&global_val_tags_lock); }