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
add function yaz_iso5426_decode
[yaz-moved-to-github.git]
/
src
/
xmalloc.c
diff --git
a/src/xmalloc.c
b/src/xmalloc.c
index
6ff7b4a
..
d5d6dad
100644
(file)
--- a/
src/xmalloc.c
+++ b/
src/xmalloc.c
@@
-1,8
+1,6
@@
-/*
- * Copyright (C) 1995-2005, Index Data ApS
- * All rights reserved.
- *
- * $Id: xmalloc.c,v 1.6 2005-06-25 15:46:06 adam Exp $
+/* This file is part of the YAZ toolkit.
+ * Copyright (C) 1995-2008 Index Data
+ * See the file LICENSE for details.
*/
/**
* \file xmalloc.c
*/
/**
* \file xmalloc.c
@@
-246,6
+244,11
@@
void xmalloc_trav_f(const char *s, const char *file, int line)
xmalloc_trav_d(file, line);
}
xmalloc_trav_d(file, line);
}
+void xmalloc_fatal(void)
+{
+ exit(1);
+}
+
void *xrealloc_f (void *o, size_t size, const char *file, int line)
{
void *p = xrealloc_d (o, size, file, line);
void *xrealloc_f (void *o, size_t size, const char *file, int line)
{
void *p = xrealloc_d (o, size, file, line);
@@
-258,12
+261,12
@@
void *xrealloc_f (void *o, size_t size, const char *file, int line)
if(log_level)
yaz_log (log_level,
if(log_level)
yaz_log (log_level,
- "%s:%d: xrealloc(s=%d) %p -> %p", file, line, size, o, p);
+ "%s:%d: xrealloc(s=%ld) %p -> %p", file, line, (long) size, o, p);
if (!p)
{
if (!p)
{
- yaz_log (YLOG_FATAL|YLOG_ERRNO, "Out of memory, realloc (%d bytes)",
- size);
- exit(1);
+ yaz_log (YLOG_FATAL|YLOG_ERRNO, "Out of memory, realloc (%ld bytes)",
+ (long) size);
+ xmalloc_fatal();
}
return p;
}
}
return p;
}
@@
-279,12
+282,14
@@
void *xmalloc_f (size_t size, const char *file, int line)
}
if (log_level)
}
if (log_level)
- yaz_log (log_level, "%s:%d: xmalloc(s=%d) %p", file, line, size, p);
+ yaz_log (log_level, "%s:%d: xmalloc(s=%ld) %p", file, line,
+ (long) size, p);
if (!p)
{
if (!p)
{
- yaz_log (YLOG_FATAL, "Out of memory - malloc (%d bytes)", size);
- exit (1);
+ yaz_log (YLOG_FATAL, "Out of memory - malloc (%ld bytes)",
+ (long) size);
+ xmalloc_fatal();
}
return p;
}
}
return p;
}
@@
-299,12
+304,14
@@
void *xcalloc_f (size_t nmemb, size_t size, const char *file, int line)
}
if (log_level)
}
if (log_level)
- yaz_log (log_level, "%s:%d: xcalloc(s=%d) %p", file, line, size, p);
+ yaz_log (log_level, "%s:%d: xcalloc(s=%ld) %p", file, line,
+ (long) size, p);
if (!p)
{
if (!p)
{
- yaz_log (YLOG_FATAL, "Out of memory - calloc (%d, %d)", nmemb, size);
- exit (1);
+ yaz_log (YLOG_FATAL, "Out of memory - calloc (%ld, %ld)",
+ (long) nmemb, (long) size);
+ xmalloc_fatal();
}
return p;
}
}
return p;
}
@@
-319,7
+326,8
@@
char *xstrdup_f (const char *s, const char *file, int line)
}
if (log_level)
}
if (log_level)
- yaz_log (log_level, "%s:%d: xstrdup(s=%d) %p", file, line, strlen(s)+1, p);
+ yaz_log (log_level, "%s:%d: xstrdup(s=%ld) %p", file, line,
+ (long) strlen(s)+1, p);
strcpy (p, s);
return p;
strcpy (p, s);
return p;