X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Fnmem.c;h=73d65e778f9eccef068d803697b68a09108ca88c;hb=30e703f75c26ad4b564e380d586d122edd49046d;hp=596d55b973951d4d39168e68087c42b150c8646b;hpb=e5e0009a3e78e4ca72b5e0a4768e300091170323;p=yaz-moved-to-github.git diff --git a/src/nmem.c b/src/nmem.c index 596d55b..73d65e7 100644 --- a/src/nmem.c +++ b/src/nmem.c @@ -1,12 +1,14 @@ /* - * Copyright (c) 1995-2003, Index Data. + * Copyright (c) 1995-2004, Index Data. * See the file LICENSE for details. - * Sebastian Hammer, Adam Dickmeiss * - * $Id: nmem.c,v 1.2 2003-12-04 11:47:50 adam Exp $ + * $Id: nmem.c,v 1.5 2004-11-03 22:33:17 adam Exp $ */ -/* +/** + * \file nmem.c + * \brief Implements Nibble Memory + * * This is a simple and fairly wasteful little module for nibble memory * allocation. Evemtually we'll put in something better. */ @@ -149,12 +151,17 @@ static void free_block(nmem_block *p) #if NMEM_DEBUG void nmem_print_list (void) { + nmem_print_list_l(LOG_DEBUG); +} + +void nmem_print_list_l (int level) +{ struct nmem_debug_info *p; - yaz_log (LOG_DEBUG, "nmem print list"); + yaz_log (level, "nmem print list"); NMEM_ENTER; for (p = nmem_debug_list; p; p = p->next) - yaz_log (LOG_DEBUG, " %s:%d p=%p size=%d", p->file, p->line, p->p, + yaz_log (level, " %s:%d p=%p size=%d", p->file, p->line, p->p, nmem_total(p->p)); NMEM_LEAVE; } @@ -354,7 +361,7 @@ void nmem_destroy(NMEM n) void nmem_transfer (NMEM dst, NMEM src) { nmem_block *t; - while ((t=src->blocks)) + while ((t = src->blocks)) { src->blocks = t->next; t->next = dst->blocks; @@ -477,8 +484,8 @@ void yaz_strerror(char *buf, int max) #endif /* UNIX */ #endif - if ((cp=strrchr(buf, '\n'))) + if ((cp = strrchr(buf, '\n'))) *cp = '\0'; - if ((cp=strrchr(buf, '\r'))) + if ((cp = strrchr(buf, '\r'))) *cp = '\0'; }