Skip to content

Commit 54ffd46

Browse files
committed
ecpg ECPGFree fix from Rene Hogendoorn.
1 parent 85bb91a commit 54ffd46

File tree

2 files changed

+48
-45
lines changed

2 files changed

+48
-45
lines changed

src/include/storage/s_lock.h

Lines changed: 47 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/include/storage/s_lock.h,v 1.66 1999/11/18 21:47:41 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/include/storage/s_lock.h,v 1.67 1999/11/23 19:47:13 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -78,35 +78,6 @@ extern void s_lock_sleep(unsigned spin);
7878
* All the gcc inlines
7979
*/
8080

81-
#if defined(__alpha__)
82-
#define TAS(lock) tas(lock)
83-
#define S_UNLOCK(lock) { __asm__("mb"); *(lock) = 0; }
84-
85-
static __inline__ int
86-
tas(volatile slock_t *lock)
87-
{
88-
register slock_t _res;
89-
90-
__asm__(" ldq $0, %0 \n\
91-
bne $0, 3f \n\
92-
ldq_l $0, %0 \n\
93-
bne $0, 3f \n\
94-
or $31, 1, $0 \n\
95-
stq_c $0, %0 \n\
96-
beq $0, 2f \n\
97-
bis $31, $31, %1 \n\
98-
mb \n\
99-
jmp $31, 4f \n\
100-
2: or $31, 1, $0 \n\
101-
3: bis $0, $0, %1 \n\
102-
4: nop ": "=m"(*lock), "=r"(_res): :"0");
103-
104-
return (int) _res;
105-
}
106-
107-
#endif /* __alpha__ */
108-
109-
11081

11182
#if defined(__i386__)
11283
#define TAS(lock) tas(lock)
@@ -226,20 +197,6 @@ tas(volatile slock_t *lock)
226197
* All non gcc
227198
*/
228199

229-
#if defined(__alpha__)
230-
/*
231-
* OSF/1 (Alpha AXP)
232-
*
233-
* Note that slock_t on the Alpha AXP is msemaphore instead of char
234-
* (see storage/ipc.h).
235-
*/
236-
#define TAS(lock) (msem_lock((lock), MSEM_IF_NOWAIT) < 0)
237-
#define S_UNLOCK(lock) msem_unlock((lock), 0)
238-
#define S_INIT_LOCK(lock) msem_init((lock), MSEM_UNLOCKED)
239-
#define S_LOCK_FREE(lock) (!(lock)->msem_state)
240-
#endif /* __alpha__ */
241-
242-
243200

244201
#if defined(NEED_I386_TAS_ASM)
245202
/* non gcc i386 based things */
@@ -272,6 +229,52 @@ tas(slock_t *s_lock)
272229
* These are the platforms that have common code for gcc and non-gcc
273230
*/
274231

232+
233+
#if defined(__alpha)
234+
235+
#if defined(__osf__)
236+
/*
237+
* OSF/1 (Alpha AXP)
238+
*
239+
* Note that slock_t on the Alpha AXP is msemaphore instead of char
240+
* (see storage/ipc.h).
241+
*/
242+
#define TAS(lock) (msem_lock((lock), MSEM_IF_NOWAIT) < 0)
243+
#define S_UNLOCK(lock) msem_unlock((lock), 0)
244+
#define S_INIT_LOCK(lock) msem_init((lock), MSEM_UNLOCKED)
245+
#define S_LOCK_FREE(lock) (!(lock)->msem_state)
246+
247+
#else /* i.e. not __osf__ */
248+
249+
#define TAS(lock) tas(lock)
250+
#define S_UNLOCK(lock) { __asm__("mb"); *(lock) = 0; }
251+
252+
static __inline__ int
253+
tas(volatile slock_t *lock)
254+
{
255+
register slock_t _res;
256+
257+
__asm__(" ldq $0, %0 \n\
258+
bne $0, 3f \n\
259+
ldq_l $0, %0 \n\
260+
bne $0, 3f \n\
261+
or $31, 1, $0 \n\
262+
stq_c $0, %0 \n\
263+
beq $0, 2f \n\
264+
bis $31, $31, %1 \n\
265+
mb \n\
266+
jmp $31, 4f \n\
267+
2: or $31, 1, $0 \n\
268+
3: bis $0, $0, %1 \n\
269+
4: nop ": "=m"(*lock), "=r"(_res): :"0");
270+
271+
return (int) _res;
272+
}
273+
#endif /* __osf__ */
274+
275+
#endif /* __alpha */
276+
277+
275278
#if defined(__hpux)
276279
/*
277280
* HP-UX (PA-RISC)

src/interfaces/ecpg/preproc/preproc.y

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -969,7 +969,7 @@ stmt: AddAttrStmt { output_statement($1, 0); }
969969
output_statement($1, 0);
970970
}
971971
| ECPGFree {
972-
fprintf(yyout, "{ ECPGdeallocate(__LINE__, %s, \"%s\");", connection ? connection : "NULL", $1);
972+
fprintf(yyout, "{ ECPGdeallocate(__LINE__, \"%s\");", $1);
973973
whenever_action(2);
974974
free($1);
975975
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy