From be5241420ab960f37fb957723da11ed277ad887d Mon Sep 17 00:00:00 2001
From: Bruce Momjian <bruce@momjian.us>
Date: Thu, 25 Sep 1997 01:48:58 +0000
Subject: [PATCH] S_LOCK_FREE fix.

---
 src/include/storage/s_lock.h | 24 +++++-------------------
 1 file changed, 5 insertions(+), 19 deletions(-)

diff --git a/src/include/storage/s_lock.h b/src/include/storage/s_lock.h
index db697242b3..927d1d91b1 100644
--- a/src/include/storage/s_lock.h
+++ b/src/include/storage/s_lock.h
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/include/storage/s_lock.h,v 1.6 1997/09/24 23:37:26 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/include/storage/s_lock.h,v 1.7 1997/09/25 01:48:58 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -55,8 +55,6 @@
 
 #define	S_INIT_LOCK(lock)	mutex_init(lock)
 
-#define S_LOCK_FREE(lock)		((*lock) == 0)
-
  /* S_LOCK_FREE should return 1 if lock is free; 0 if lock is locked */
 /* For Mach, we have to delve inside the entrails of `struct mutex'.  Ick! */
 #define	S_LOCK_FREE(alock)	((alock)->lock == 0)
@@ -135,8 +133,6 @@ static int	tas(slock_t *lock);
 
 #define	S_INIT_LOCK(lock)	S_UNLOCK(lock)
 
-#define S_LOCK_FREE(lock)		((*lock) == 0)
-
 #endif							/* i86pc_solaris || sparc_solaris */
 
 /*
@@ -158,8 +154,6 @@ static int	tas(slock_t *lock);
 
 #define	S_INIT_LOCK(lock)	S_UNLOCK(lock)
 
-#define S_LOCK_FREE(lock)		((*lock) == 0)
-
 #endif							/* aix */
 
 /*
@@ -211,8 +205,6 @@ static int	tas(slock_t *lock);
 
 #define	S_INIT_LOCK(lock)	S_UNLOCK(lock)
 
-#define S_LOCK_FREE(lock)		((*lock) == 0)
-
 static int
 tas_dummy()
 {
@@ -295,8 +287,6 @@ tas_dummy()
 
 #define	S_INIT_LOCK(addr)	(*(addr) = 0)
 
-#define S_LOCK_FREE(lock)		((*lock) == 0)
-
 #endif							/* NEED_SPARC_TAS_ASM */
 
 /*
@@ -318,8 +308,6 @@ tas_dummy()
 
 #define	S_INIT_LOCK(lock)	S_UNLOCK(lock)
 
-#define S_LOCK_FREE(lock)		((*lock) == 0)
-
 #endif							/* NEED_I386_TAS_ASM */
 
 
@@ -351,8 +339,6 @@ tas_dummy()
 
 #define	S_INIT_LOCK(lock)	S_UNLOCK(lock)
 
-#define S_LOCK_FREE(lock)		((*lock) == 0)
-
 #endif							/* defined(__alpha__) && defined(linux) */
 
 #if defined(linux) && defined(sparc)
@@ -372,8 +358,6 @@ tas_dummy()
 
 #define	S_INIT_LOCK(lock)	S_UNLOCK(lock)
 
-#define S_LOCK_FREE(lock)		((*lock) == 0)
-
 #endif							/* defined(linux) && defined(sparc) */
 
 #if defined(linux) && defined(PPC)
@@ -407,10 +391,12 @@ success:		\n\
 
 #define	S_INIT_LOCK(lock)	S_UNLOCK(lock)
 
-#define S_LOCK_FREE(lock)		((*lock) == 0)
-
 #endif							/* defined(linux) && defined(PPC) */
 
+#ifndef S_LOCK_FREE		/* for those who have not already defined it */
+#define S_LOCK_FREE(lock)		((*lock) == 0)
+#endif
+
 #endif							/* HAS_TEST_AND_SET */
 
 #endif							/* S_LOCK_H */ 
-- 
2.49.0