* Copyright (C) 1995-2005, Index Data ApS
* See the file LICENSE for details.
*
- * $Id: nmem.c,v 1.14 2005-01-21 09:23:27 adam Exp $
+ * $Id: nmem.c,v 1.17 2005-06-03 20:33:13 adam Exp $
*/
/**
#define NMEM_CHUNK (4*1024)
+struct nmem_block
+{
+ char *buf; /* memory allocated in this block */
+ size_t size; /* size of buf */
+ size_t top; /* top of buffer */
+ struct nmem_block *next;
+};
+
+struct nmem_control
+{
+ int total;
+ nmem_block *blocks;
+ struct nmem_control *next;
+};
+
struct align {
char x;
union {
YAZ_EXPORT void nmem_mutex_create(NMEM_MUTEX *p)
{
- if (!log_level_initialized)
- {
- log_level = yaz_log_module_level("nmem");
- log_level_initialized = 1;
- }
-
if (!*p)
{
*p = (NMEM_MUTEX) malloc (sizeof(**p));
pth_mutex_init (&(*p)->m_handle);
#endif
}
+ if (!log_level_initialized)
+ {
+ log_level_initialized = 1;
+ log_level = yaz_log_module_level("nmem");
+ }
+
}
YAZ_EXPORT void nmem_mutex_enter(NMEM_MUTEX p)