* Copyright (C) 1995-2005, Index Data ApS
* See the file LICENSE for details.
*
- * $Id: nmem.c,v 1.13 2005-01-17 13:03:27 adam Exp $
+ * $Id: nmem.c,v 1.14 2005-01-21 09:23:27 adam Exp $
*/
/**
#define NMEM_ALIGN (offsetof(struct align, u))
-static int log_level=0;
-static int log_level_initialized=0;
+static int log_level = 0;
+static int log_level_initialized = 0;
#ifdef WIN32
static CRITICAL_SECTION critical_section;
{
if (!log_level_initialized)
{
- log_level=yaz_log_module_level("nmem");
- log_level_initialized=1;
+ log_level = yaz_log_module_level("nmem");
+ log_level_initialized = 1;
}
- NMEM_ENTER;
if (!*p)
{
*p = (NMEM_MUTEX) malloc (sizeof(**p));
pth_mutex_init (&(*p)->m_handle);
#endif
}
- NMEM_LEAVE;
}
YAZ_EXPORT void nmem_mutex_enter(NMEM_MUTEX p)
YAZ_EXPORT void nmem_mutex_destroy(NMEM_MUTEX *p)
{
- NMEM_ENTER;
if (*p)
{
#ifdef WIN32
free (*p);
*p = 0;
}
- NMEM_LEAVE;
}
static nmem_block *freelist = NULL; /* "global" freelists */
#endif
if (!log_level_initialized)
{
- log_level=yaz_log_module_level("nmem");
- log_level_initialized=1;
+ log_level = yaz_log_module_level("nmem");
+ log_level_initialized = 1;
}
NMEM_ENTER;
void nmem_init (void)
{
- if (!log_level_initialized)
- {
- log_level=yaz_log_module_level("nmem");
- log_level_initialized=1;
- }
if (++nmem_init_flag == 1)
{
#ifdef WIN32
InitializeCriticalSection(&critical_section);
#elif YAZ_GNU_THREADS
- yaz_log (log_level, "pth_init"); /* ??? */
pth_init ();
#endif
nmem_active_no = 0;
freelist = NULL;
cfreelist = NULL;
}
+ if (!log_level_initialized)
+ {
+ log_level = yaz_log_module_level("nmem");
+ log_level_initialized = 1;
+ }
}
void nmem_exit (void)