1
/* $Id: xmalloc.h,v 1.6 2004/02/24 18:39:16 m-a Exp $ */
10
/* special defines for xmalloc.c, xcalloc.c, etc */
11
#ifndef ENABLE_MEMDEBUG
12
#define bf_malloc malloc
13
#define bf_calloc calloc
14
#define bf_realloc realloc
22
/** print out of memory error and exit program */
23
void xmem_error(const char *)
25
__attribute__((noreturn))
30
/** print string too long error and exit program */
31
void xmem_toolong(const char *)
33
__attribute__((noreturn))
37
/*@only@*/ /*@out@*/ /*@notnull@*/
38
/** allocate \a size bytes of memory, exit program on allocation failure
40
void *xmalloc(size_t size);
42
/** free memory area at \a ptr if ptr is non-NULL, do nothing if \a ptr
44
void xfree(/*@only@*/ /*@null@*/ void *ptr);
46
/** allocate and clear \a nmemb blocks of \a size bytes of memory, exit
47
* program on allocation failure */
48
/*@only@*/ /*@out@*/ /*@notnull@*/
49
void *xcalloc(size_t nmemb, size_t size);
51
/** reallocate \a size bytes of memory and initialize it with the
52
* first bytes of the shorter area (old in \a ptr vs. newly allocated),
53
* exit program on allocation failure */
54
/*@only@*/ /*@out@*/ /*@notnull@*/
55
void *xrealloc(/*@only@*/ void *ptr, size_t size);