Last change
on this file since 3853 was 3191, checked in by Bruno Cornec, 11 years ago |
- Lots of memory management backports from 3.1 to 3.2 - still not finished, nor working ATM. the common subdir was done during travel, so this is essentially a backup !
|
-
Property svn:eol-style
set to
native
|
File size:
657 bytes
|
Rev | Line | |
---|
[1054] | 1 | /*
|
---|
| 2 | * $Id$
|
---|
| 3 | *
|
---|
| 4 | * Code (c)2006 Bruno Cornec <bruno@mondorescue.org>
|
---|
| 5 | *
|
---|
| 6 | * Main file of mr_err : a very small and simple
|
---|
| 7 | * library for error management
|
---|
| 8 | *
|
---|
| 9 | * Provided under the GPLv2
|
---|
| 10 | */
|
---|
| 11 |
|
---|
[1064] | 12 | #ifndef _GNU_SOURCE
|
---|
| 13 | #define _GNU_SOURCE
|
---|
| 14 | #endif
|
---|
| 15 |
|
---|
[1054] | 16 | #include <stdio.h>
|
---|
| 17 | #include <stdlib.h>
|
---|
[3191] | 18 | #include "mr_msg.h"
|
---|
[1054] | 19 |
|
---|
[1264] | 20 | /* Pointer to the right cleanup function provided by each main */
|
---|
[3191] | 21 | extern void (*mr_cleanup)(int);
|
---|
[1054] | 22 |
|
---|
| 23 | /*
|
---|
| 24 | * Function that frees memory if necessary
|
---|
| 25 | */
|
---|
| 26 | void mr_exit(int errorcode, const char *message) {
|
---|
| 27 |
|
---|
[1422] | 28 | if (mr_cleanup != NULL) {
|
---|
[3191] | 29 | mr_cleanup(errorcode);
|
---|
[1422] | 30 | }
|
---|
[1256] | 31 | if (message != NULL) {
|
---|
| 32 | fprintf(stderr,"%s\n",message);
|
---|
| 33 | }
|
---|
[3191] | 34 | mr_msg_close();
|
---|
[1054] | 35 | exit(errorcode);
|
---|
| 36 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.