aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/ecpg/ecpglib/misc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/interfaces/ecpg/ecpglib/misc.c')
-rw-r--r--src/interfaces/ecpg/ecpglib/misc.c47
1 files changed, 0 insertions, 47 deletions
diff --git a/src/interfaces/ecpg/ecpglib/misc.c b/src/interfaces/ecpg/ecpglib/misc.c
index 7f75e18733e..2b78caeaf52 100644
--- a/src/interfaces/ecpg/ecpglib/misc.c
+++ b/src/interfaces/ecpg/ecpglib/misc.c
@@ -55,42 +55,11 @@ static struct sqlca_t sqlca_init =
}
};
-#ifdef ENABLE_THREAD_SAFETY
static pthread_key_t sqlca_key;
static pthread_once_t sqlca_key_once = PTHREAD_ONCE_INIT;
-#else
-static struct sqlca_t sqlca =
-{
- {
- 'S', 'Q', 'L', 'C', 'A', ' ', ' ', ' '
- },
- sizeof(struct sqlca_t),
- 0,
- {
- 0,
- {
- 0
- }
- },
- {
- 'N', 'O', 'T', ' ', 'S', 'E', 'T', ' '
- },
- {
- 0, 0, 0, 0, 0, 0
- },
- {
- 0, 0, 0, 0, 0, 0, 0, 0
- },
- {
- '0', '0', '0', '0', '0'
- }
-};
-#endif
-#ifdef ENABLE_THREAD_SAFETY
static pthread_mutex_t debug_mutex = PTHREAD_MUTEX_INITIALIZER;
static pthread_mutex_t debug_init_mutex = PTHREAD_MUTEX_INITIALIZER;
-#endif
static int simple_debug = 0;
static FILE *debugstream = NULL;
@@ -123,7 +92,6 @@ ecpg_init(const struct connection *con, const char *connection_name, const int l
return true;
}
-#ifdef ENABLE_THREAD_SAFETY
static void
ecpg_sqlca_key_destructor(void *arg)
{
@@ -135,12 +103,10 @@ ecpg_sqlca_key_init(void)
{
pthread_key_create(&sqlca_key, ecpg_sqlca_key_destructor);
}
-#endif
struct sqlca_t *
ECPGget_sqlca(void)
{
-#ifdef ENABLE_THREAD_SAFETY
struct sqlca_t *sqlca;
pthread_once(&sqlca_key_once, ecpg_sqlca_key_init);
@@ -155,9 +121,6 @@ ECPGget_sqlca(void)
pthread_setspecific(sqlca_key, sqlca);
}
return sqlca;
-#else
- return &sqlca;
-#endif
}
bool
@@ -240,9 +203,7 @@ ECPGtrans(int lineno, const char *connection_name, const char *transaction)
void
ECPGdebug(int n, FILE *dbgs)
{
-#ifdef ENABLE_THREAD_SAFETY
pthread_mutex_lock(&debug_init_mutex);
-#endif
if (n > 100)
{
@@ -256,9 +217,7 @@ ECPGdebug(int n, FILE *dbgs)
ecpg_log("ECPGdebug: set to %d\n", simple_debug);
-#ifdef ENABLE_THREAD_SAFETY
pthread_mutex_unlock(&debug_init_mutex);
-#endif
}
void
@@ -290,9 +249,7 @@ ecpg_log(const char *format,...)
else
snprintf(fmt, bufsize, "[%d]: %s", (int) getpid(), intl_format);
-#ifdef ENABLE_THREAD_SAFETY
pthread_mutex_lock(&debug_mutex);
-#endif
va_start(ap, format);
vfprintf(debugstream, fmt, ap);
@@ -307,9 +264,7 @@ ecpg_log(const char *format,...)
fflush(debugstream);
-#ifdef ENABLE_THREAD_SAFETY
pthread_mutex_unlock(&debug_mutex);
-#endif
free(fmt);
}
@@ -451,7 +406,6 @@ ECPGis_noind_null(enum ECPGttype type, const void *ptr)
}
#ifdef WIN32
-#ifdef ENABLE_THREAD_SAFETY
void
win32_pthread_mutex(volatile pthread_mutex_t *mutex)
@@ -482,7 +436,6 @@ win32_pthread_once(volatile pthread_once_t *once, void (*fn) (void))
pthread_mutex_unlock(&win32_pthread_once_lock);
}
}
-#endif /* ENABLE_THREAD_SAFETY */
#endif /* WIN32 */
#ifdef ENABLE_NLS