projects
/
yaz-moved-to-github.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
SOLR facets: no magic for non-date facets
[yaz-moved-to-github.git]
/
src
/
nmem.c
diff --git
a/src/nmem.c
b/src/nmem.c
index
93988b5
..
bca3366
100644
(file)
--- a/
src/nmem.c
+++ b/
src/nmem.c
@@
-1,5
+1,5
@@
/* This file is part of the YAZ toolkit.
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2009 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
* See the file LICENSE for details.
*/
@@
-8,10
+8,8
@@
* \brief Implements Nibble Memory
*
* This is a simple and fairly wasteful little module for nibble memory
* \brief Implements Nibble Memory
*
* This is a simple and fairly wasteful little module for nibble memory
- * allocation. Evemtually we'll put in something better.
+ * allocation.
*
*
- * FIXME - it also has some semaphore stuff, and stuff to handle errno.
- * These should be moved to some other place!
*/
#if HAVE_CONFIG_H
#include <config.h>
*/
#if HAVE_CONFIG_H
#include <config.h>
@@
-38,7
+36,7
@@
struct nmem_block
struct nmem_control
{
struct nmem_control
{
- int total;
+ size_t total;
struct nmem_block *blocks;
struct nmem_control *next;
};
struct nmem_block *blocks;
struct nmem_control *next;
};
@@
-68,7
+66,7
@@
static void free_block(struct nmem_block *p)
xfree(p->buf);
xfree(p);
if (log_level)
xfree(p->buf);
xfree(p);
if (log_level)
- yaz_log (log_level, "nmem free_block p=%p", p);
+ yaz_log(log_level, "nmem free_block p=%p", p);
}
/*
}
/*
@@
-80,14
+78,13
@@
static struct nmem_block *get_block(size_t size)
size_t get = NMEM_CHUNK;
if (log_level)
size_t get = NMEM_CHUNK;
if (log_level)
- yaz_log (log_level, "nmem get_block size=%ld", (long) size);
+ yaz_log(log_level, "nmem get_block size=%ld", (long) size);
-
if (get < size)
get = size;
if (get < size)
get = size;
- if(log_level)
- yaz_log (log_level, "nmem get_block alloc new block size=%ld",
- (long) get);
+ if (log_level)
+ yaz_log(log_level, "nmem get_block alloc new block size=%ld",
+ (long) get);
r = (struct nmem_block *) xmalloc(sizeof(*r));
r->buf = (char *)xmalloc(r->size = get);
r = (struct nmem_block *) xmalloc(sizeof(*r));
r->buf = (char *)xmalloc(r->size = get);
@@
-99,7
+96,7
@@
void nmem_reset(NMEM n)
{
struct nmem_block *t;
{
struct nmem_block *t;
- yaz_log (log_level, "nmem_reset p=%p", n);
+ yaz_log(log_level, "nmem_reset p=%p", n);
if (!n)
return;
while (n->blocks)
if (!n)
return;
while (n->blocks)
@@
-111,15
+108,15
@@
void nmem_reset(NMEM n)
n->total = 0;
}
n->total = 0;
}
-void *nmem_malloc(NMEM n, int size)
+void *nmem_malloc(NMEM n, size_t size)
{
struct nmem_block *p;
char *r;
if (!n)
{
{
struct nmem_block *p;
char *r;
if (!n)
{
- yaz_log (YLOG_FATAL, "calling nmem_malloc with an null pointer");
- abort ();
+ yaz_log(YLOG_FATAL, "calling nmem_malloc with an null pointer");
+ abort();
}
p = n->blocks;
if (!p || p->size < size + p->top)
}
p = n->blocks;
if (!p || p->size < size + p->top)
@@
-135,7
+132,7
@@
void *nmem_malloc(NMEM n, int size)
return r;
}
return r;
}
-int nmem_total(NMEM n)
+size_t nmem_total(NMEM n)
{
return n->total;
}
{
return n->total;
}
@@
-167,7
+164,7
@@
void nmem_destroy(NMEM n)
xfree(n);
}
xfree(n);
}
-void nmem_transfer (NMEM dst, NMEM src)
+void nmem_transfer(NMEM dst, NMEM src)
{
struct nmem_block *t;
while ((t = src->blocks))
{
struct nmem_block *t;
while ((t = src->blocks))