]> granicus.if.org Git - postgresql/commitdiff
ecpg ECPGFree fix from Rene Hogendoorn.
authorBruce Momjian <bruce@momjian.us>
Tue, 23 Nov 1999 19:47:14 +0000 (19:47 +0000)
committerBruce Momjian <bruce@momjian.us>
Tue, 23 Nov 1999 19:47:14 +0000 (19:47 +0000)
src/include/storage/s_lock.h
src/interfaces/ecpg/preproc/preproc.y

index e23e2076e4bd8fd0ac2a3dcefadce65f6debf295..fd9d1dbf85ee2d988181cd933a2e7093efe2f24a 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/include/storage/s_lock.h,v 1.66 1999/11/18 21:47:41 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/include/storage/s_lock.h,v 1.67 1999/11/23 19:47:13 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -78,35 +78,6 @@ extern void s_lock_sleep(unsigned spin);
  * All the gcc inlines
  */
 
-#if defined(__alpha__)
-#define TAS(lock) tas(lock)
-#define S_UNLOCK(lock) { __asm__("mb"); *(lock) = 0; }
-
-static __inline__ int
-tas(volatile slock_t *lock)
-{
-       register slock_t _res;
-
-__asm__("    ldq   $0, %0              \n\
-                 bne   $0, 3f          \n\
-                 ldq_l $0, %0             \n\
-                 bne   $0, 3f          \n\
-                 or    $31, 1, $0          \n\
-                 stq_c $0, %0             \n\
-                 beq   $0, 2f              \n\
-                 bis   $31, $31, %1        \n\
-                 mb                               \n\
-                 jmp   $31, 4f            \n\
-              2: or    $31, 1, $0             \n\
-              3: bis   $0, $0, %1             \n\
-              4: nop      ": "=m"(*lock), "=r"(_res): :"0");
-
-       return (int) _res;
-}
-
-#endif  /* __alpha__ */
-
-
 
 #if defined(__i386__)
 #define TAS(lock) tas(lock)
@@ -226,20 +197,6 @@ tas(volatile slock_t *lock)
  * All non gcc
  */
 
-#if defined(__alpha__)
-/*
- * OSF/1 (Alpha AXP)
- *
- * Note that slock_t on the Alpha AXP is msemaphore instead of char
- * (see storage/ipc.h).
- */
-#define TAS(lock)      (msem_lock((lock), MSEM_IF_NOWAIT) < 0)
-#define S_UNLOCK(lock) msem_unlock((lock), 0)
-#define S_INIT_LOCK(lock)      msem_init((lock), MSEM_UNLOCKED)
-#define S_LOCK_FREE(lock)      (!(lock)->msem_state)
-#endif  /* __alpha__ */
-
-
 
 #if defined(NEED_I386_TAS_ASM)
 /* non gcc i386 based things */
@@ -272,6 +229,52 @@ tas(slock_t *s_lock)
  * These are the platforms that have common code for gcc and non-gcc
  */
 
+
+#if defined(__alpha)
+
+#if defined(__osf__)
+/*
+ * OSF/1 (Alpha AXP)
+ *
+ * Note that slock_t on the Alpha AXP is msemaphore instead of char
+ * (see storage/ipc.h).
+ */
+#define TAS(lock)        (msem_lock((lock), MSEM_IF_NOWAIT) < 0)
+#define S_UNLOCK(lock) msem_unlock((lock), 0)
+#define S_INIT_LOCK(lock)              msem_init((lock), MSEM_UNLOCKED)
+#define S_LOCK_FREE(lock)        (!(lock)->msem_state)
+
+#else /* i.e. not __osf__ */
+
+#define TAS(lock) tas(lock)
+#define S_UNLOCK(lock) { __asm__("mb"); *(lock) = 0; }
+
+static __inline__ int
+tas(volatile slock_t *lock)
+{
+ register slock_t _res;
+
+__asm__("       ldq   $0, %0                      \n\
+                                bne   $0, 3f              \n\
+                                ldq_l $0, %0                    \n\
+                                bne   $0, 3f              \n\
+                                or    $31, 1, $0                  \n\
+                                stq_c $0, %0                              \n\
+                                beq   $0, 2f                      \n\
+                                bis   $31, $31, %1        \n\
+                                mb                                                        \n\
+                                jmp   $31, 4f                     \n\
+                         2: or    $31, 1, $0                      \n\
+                         3: bis   $0, $0, %1              \n\
+                         4: nop          ": "=m"(*lock), "=r"(_res): :"0");
+
+       return (int) _res;
+}
+#endif /* __osf__ */
+
+#endif /* __alpha */
+
+
 #if defined(__hpux)
 /*
  * HP-UX (PA-RISC)
index eb7e79fac8529d866f70a7183dd0b8f041ec5d9e..0d52ec6fe658139002cc4d9267ace5a6b6956d8b 100644 (file)
@@ -969,7 +969,7 @@ stmt:  AddAttrStmt                  { output_statement($1, 0); }
                                                output_statement($1, 0);
                                        }
                | ECPGFree              {
-                                               fprintf(yyout, "{ ECPGdeallocate(__LINE__, %s, \"%s\");", connection ? connection : "NULL", $1); 
+                        fprintf(yyout, "{ ECPGdeallocate(__LINE__, \"%s\");", $1); 
                                                whenever_action(2);
                                                free($1);
                                        }