Break long line
[yaz-moved-to-github.git] / util / xmalloc.c
index 1b33b63..96bc73a 100644 (file)
@@ -1,9 +1,9 @@
 /*
- * Copyright (C) 1994-2001, Index Data
+ * Copyright (C) 1994-2003, Index Data
  * All rights reserved.
  * Sebastian Hammer, Adam Dickmeiss
  *
- * $Id: xmalloc.c,v 1.14 2001-11-06 17:05:19 adam Exp $
+ * $Id: xmalloc.c,v 1.18 2003-01-06 08:20:28 adam Exp $
  */
 
 #if HAVE_CONFIG_H
@@ -17,7 +17,9 @@
 #include <yaz/log.h>
 #include <yaz/xmalloc.h>
 
-#define TRACE_XMALLOC 2
+#ifndef TRACE_XMALLOC
+#define TRACE_XMALLOC 1
+#endif
 
 #if TRACE_XMALLOC > 1
 
@@ -182,15 +184,15 @@ void xmalloc_trav_d(const char *file, int line)
     size_t size = 0;
     struct dmalloc_info *dinfo = dmalloc_list;
     
-    yaz_log (LOG_LOG, "malloc_trav %s:%d", file, line);
+    yaz_log (LOG_MALLOC, "malloc_trav %s:%d", file, line);
     while (dinfo)
     {
-       yaz_log (LOG_LOG, " %20s:%d p=%p size=%d", dinfo->file, dinfo->line,
+       yaz_log (LOG_MALLOC, " %20s:%d p=%p size=%d", dinfo->file, dinfo->line,
              ((char*) dinfo)+sizeof(*dinfo)+4*sizeof(char), dinfo->len);
        size += dinfo->len;
        dinfo = dinfo->next;
     }
-    yaz_log (LOG_LOG, "total bytes %ld", (long) size);
+    yaz_log (LOG_MALLOC, "total bytes %ld", (long) size);
 }
 
 #else
@@ -212,7 +214,7 @@ void *xrealloc_f (void *o, size_t size, const char *file, int line)
     void *p = xrealloc_d (o, size, file, line);
 
 #if TRACE_XMALLOC
-    yaz_log (LOG_DEBUG,
+    yaz_log (LOG_MALLOC,
             "%s:%d: xrealloc(s=%d) %p -> %p", file, line, size, o, p);
 #endif
     if (!p)
@@ -229,7 +231,7 @@ void *xmalloc_f (size_t size, const char *file, int line)
     void *p = xmalloc_d (size, file, line);
     
 #if TRACE_XMALLOC
-    yaz_log (LOG_DEBUG, "%s:%d: xmalloc(s=%d) %p", file, line, size, p);
+    yaz_log (LOG_MALLOC, "%s:%d: xmalloc(s=%d) %p", file, line, size, p);
 #endif
     if (!p)
     {
@@ -243,7 +245,7 @@ void *xcalloc_f (size_t nmemb, size_t size, const char *file, int line)
 {
     void *p = xcalloc_d (nmemb, size, file, line);
 #if TRACE_XMALLOC
-    yaz_log (LOG_DEBUG, "%s:%d: xcalloc(s=%d) %p", file, line, size, p);
+    yaz_log (LOG_MALLOC, "%s:%d: xcalloc(s=%d) %p", file, line, size, p);
 #endif
     if (!p)
     {
@@ -257,7 +259,7 @@ char *xstrdup_f (const char *s, const char *file, int line)
 {
     char *p = (char *)xmalloc_d (strlen(s)+1, file, line);
 #if TRACE_XMALLOC
-    yaz_log (LOG_DEBUG, "%s:%d: xstrdup(s=%d) %p", file, line, strlen(s)+1, p);
+    yaz_log (LOG_MALLOC, "%s:%d: xstrdup(s=%d) %p", file, line, strlen(s)+1, p);
 #endif
     strcpy (p, s);
     return p;
@@ -269,7 +271,7 @@ void xfree_f(void *p, const char *file, int line)
         return ;
 #if TRACE_XMALLOC
     if (p)
-        yaz_log (LOG_DEBUG, "%s:%d: xfree %p", file, line, p);
+        yaz_log (LOG_MALLOC, "%s:%d: xfree %p", file, line, p);
 #endif
     xfree_d(p, file, line);
 }