1 /* 2 Fatal-on-failure memory allocation 3 4 $Id: xmalloc.h,v 1.1 2005/07/19 18:50:00 andymort Exp $ 5 */ 6 7 #ifndef xmalloc_h_INCLUDED 8 #define xmalloc_h_INCLUDED 9 10 #include <stdlib.h> 11 12 #ifdef __cplusplus 13 extern "C" { 14 #endif 15 16 /* memory allocation */ 17 void *xmalloc (size_t size); 18 void *xrealloc (void *ptr, size_t size); 19 20 /* exit with fatal error */ 21 #ifdef __GNUC__ 22 /* tell GCC more about the function, so it can optimise/debug better */ 23 void fatal(char *fmt, ...) __attribute__ ((noreturn,format(printf,1,2))); 24 #else /* __GNUC__ */ 25 void fatal(char *fmt, ...); 26 #endif /* __GNUC__ */ 27 28 #ifdef __cplusplus 29 } 30 #endif 31 32 #endif 33