/* * $Id$ * * Code (c)2006 Bruno Cornec * * Main file of mr_err : a very small and simple * library for error management * * Provided under the GPLv2 */ #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif #include #include /* Pointer to the right cleanup function provided by each main */ extern void (*mr_cleanup)(void); /* * Function that frees memory if necessary */ void mr_exit(int errorcode, const char *message) { if (mr_cleanup != NULL) { mr_cleanup(); } if (message != NULL) { fprintf(stderr,"%s\n",message); } exit(errorcode); }