X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Fxmalloc.c;h=8ef1d8fd415a6fb6e7a9c737fb2340a733eb0764;hb=3b792849c676d96918850e2f1e0af87a75278501;hp=d48daa4d5aaee128d8c583ad9938456967de39f8;hpb=d57ade59211707b9bcfacc61039e446c9fa3f36f;p=yaz-moved-to-github.git diff --git a/src/xmalloc.c b/src/xmalloc.c index d48daa4..8ef1d8f 100644 --- a/src/xmalloc.c +++ b/src/xmalloc.c @@ -1,8 +1,8 @@ /* - * Copyright (C) 1995-2005, Index Data ApS + * Copyright (C) 1995-2007, Index Data ApS * All rights reserved. * - * $Id: xmalloc.c,v 1.7 2006-04-21 10:28:07 adam Exp $ + * $Id: xmalloc.c,v 1.9 2007-01-03 08:42:15 adam Exp $ */ /** * \file xmalloc.c @@ -246,6 +246,11 @@ void xmalloc_trav_f(const char *s, const char *file, int 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); @@ -263,7 +268,7 @@ void *xrealloc_f (void *o, size_t size, const char *file, int line) { yaz_log (YLOG_FATAL|YLOG_ERRNO, "Out of memory, realloc (%ld bytes)", (long) size); - exit(1); + xmalloc_fatal(); } return p; } @@ -286,7 +291,7 @@ void *xmalloc_f (size_t size, const char *file, int line) { yaz_log (YLOG_FATAL, "Out of memory - malloc (%ld bytes)", (long) size); - exit (1); + xmalloc_fatal(); } return p; } @@ -308,7 +313,7 @@ void *xcalloc_f (size_t nmemb, size_t size, const char *file, int line) { yaz_log (YLOG_FATAL, "Out of memory - calloc (%ld, %ld)", (long) nmemb, (long) size); - exit (1); + xmalloc_fatal(); } return p; }