2 * Copyright (C) 1994, Index Data I/S
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.1 1995-11-01 11:56:53 quinn
10 * Revision 1.6 1995/10/16 14:03:11 quinn
11 * Changes to support element set names and espec1
13 * Revision 1.5 1995/09/04 12:34:06 adam
14 * Various cleanup. YAZ util used instead.
16 * Revision 1.4 1994/10/05 10:16:16 quinn
17 * Added xrealloc. Fixed bug in log.
19 * Revision 1.3 1994/09/26 16:31:37 adam
22 * Revision 1.2 1994/08/18 08:23:26 adam
23 * Res.c now use handles. xmalloc defines xstrdup.
25 * Revision 1.1 1994/08/17 13:37:54 adam
26 * xmalloc.c added to util.
38 void *xrealloc_f (void *o, size_t size, char *file, int line)
43 fprintf(stderr, "%s:%d: xrealloc(s=%d)\n", file, line, size);
45 p = realloc (o, size);
48 logf (LOG_FATAL|LOG_ERRNO, "Out of memory, realloc (%d bytes)", size);
54 void *xmalloc_f (size_t size, char *file, int line)
59 fprintf(stderr, "%s:%d: xmalloc(s=%d)\n", file, line, size);
64 logf (LOG_FATAL, "Out of memory - malloc (%d bytes)", size);
70 void *xcalloc_f (size_t nmemb, size_t size, char *file, int line)
74 fprintf(stderr, "%s:%d: xcalloc(s=%d)\n", file, line, size);
76 p = calloc (nmemb, size);
79 logf (LOG_FATAL, "Out of memory - calloc (%d, %d)", nmemb, size);
85 char *xstrdup_f (const char *s, char *file, int line)
87 char *p = xmalloc (strlen(s)+1);
89 fprintf(stderr, "%s:%d: xstrdup(s=%d)\n", file, line, strlen(s)+1);
96 void xfree_f(void *p, char *file, int line)
99 fprintf(stderr, "%s:%d: xfree\n", file, line);