Diffstat (limited to 'libical/src/libical/icalerror.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libical/src/libical/icalerror.h | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/libical/src/libical/icalerror.h b/libical/src/libical/icalerror.h index 52f5ba9..826c8e8 100644 --- a/libical/src/libical/icalerror.h +++ b/libical/src/libical/icalerror.h | |||
@@ -38,7 +38,7 @@ | |||
38 | #define ICAL_SETERROR_ISFUNC | 38 | #define ICAL_SETERROR_ISFUNC |
39 | 39 | ||
40 | 40 | ||
41 | /* This routine is called before any error is triggered. It is called | 41 | /** This routine is called before any error is triggered. It is called |
42 | by icalerror_set_errno, so it does not appear in all of the macros | 42 | by icalerror_set_errno, so it does not appear in all of the macros |
43 | below */ | 43 | below */ |
44 | void icalerror_stop_here(void); | 44 | void icalerror_stop_here(void); |
@@ -46,7 +46,7 @@ void icalerror_stop_here(void); | |||
46 | void icalerror_crash_here(void); | 46 | void icalerror_crash_here(void); |
47 | 47 | ||
48 | typedef enum icalerrorenum { | 48 | typedef enum icalerrorenum { |
49 | 49 | ICAL_NO_ERROR, /* icalerrno may not be initialized - put it first so and pray that the compiler initialize things to zero */ | |
50 | ICAL_BADARG_ERROR, | 50 | ICAL_BADARG_ERROR, |
51 | ICAL_NEWFAILED_ERROR, | 51 | ICAL_NEWFAILED_ERROR, |
52 | ICAL_ALLOCATION_ERROR, | 52 | ICAL_ALLOCATION_ERROR, |
@@ -56,15 +56,18 @@ typedef enum icalerrorenum { | |||
56 | ICAL_FILE_ERROR, | 56 | ICAL_FILE_ERROR, |
57 | ICAL_USAGE_ERROR, | 57 | ICAL_USAGE_ERROR, |
58 | ICAL_UNIMPLEMENTED_ERROR, | 58 | ICAL_UNIMPLEMENTED_ERROR, |
59 | ICAL_UNKNOWN_ERROR, /* Used for problems in input to icalerror_strerror()*/ | 59 | ICAL_UNKNOWN_ERROR /* Used for problems in input to icalerror_strerror()*/ |
60 | ICAL_NO_ERROR | ||
61 | 60 | ||
62 | } icalerrorenum; | 61 | } icalerrorenum; |
63 | 62 | ||
64 | /* The libical error enumeration, like errno*/ | 63 | icalerrorenum * icalerrno_return(void); |
65 | extern icalerrorenum icalerrno; | 64 | #define icalerrno (*(icalerrno_return())) |
66 | 65 | ||
67 | /* If true, libicl aborts after a call to icalerror_set_error*/ | 66 | /** If true, libicl aborts after a call to icalerror_set_error |
67 | * | ||
68 | * @warning NOT THREAD SAFE -- recommended that you do not change | ||
69 | * this in a multithreaded program. | ||
70 | */ | ||
68 | extern int icalerror_errors_are_fatal; | 71 | extern int icalerror_errors_are_fatal; |
69 | 72 | ||
70 | /* Warning messages */ | 73 | /* Warning messages */ |
@@ -77,6 +80,7 @@ extern int icalerror_errors_are_fatal; | |||
77 | 80 | ||
78 | 81 | ||
79 | void icalerror_clear_errno(void); | 82 | void icalerror_clear_errno(void); |
83 | void _icalerror_set_errno(icalerrorenum); | ||
80 | 84 | ||
81 | /* Make an individual error fatal or non-fatal. */ | 85 | /* Make an individual error fatal or non-fatal. */ |
82 | typedef enum icalerrorstate { | 86 | typedef enum icalerrorstate { |
@@ -94,14 +98,15 @@ icalerrorstate icalerror_get_error_state( icalerrorenum error); | |||
94 | #ifndef ICAL_SETERROR_ISFUNC | 98 | #ifndef ICAL_SETERROR_ISFUNC |
95 | #define icalerror_set_errno(x) \ | 99 | #define icalerror_set_errno(x) \ |
96 | icalerrno = x; \ | 100 | icalerrno = x; \ |
101 | fprintf(stderr,"Ical error # %d\n", x); \ | ||
97 | if(icalerror_get_error_state(x)==ICAL_ERROR_FATAL || \ | 102 | if(icalerror_get_error_state(x)==ICAL_ERROR_FATAL || \ |
98 | (icalerror_get_error_state(x)==ICAL_ERROR_DEFAULT && \ | 103 | (icalerror_get_error_state(x)==ICAL_ERROR_DEFAULT && \ |
99 | icalerror_errors_are_fatal == 1 )){ \ | 104 | icalerror_errors_are_fatal == 1 )){ \ |
100 | icalerror_warn(icalerror_strerror(x)); \ | 105 | icalerror_warn(icalerror_strerror(x)); \ |
101 | assert(0); \ | 106 | assert(0); \ |
102 | } | 107 | } |
103 | #else | 108 | #else |
104 | void icalerror_set_errno(icalerrorenum); | 109 | void icalerror_set_errno(icalerrorenum x); |
105 | #endif | 110 | #endif |
106 | 111 | ||
107 | #ifdef ICAL_ERRORS_ARE_FATAL | 112 | #ifdef ICAL_ERRORS_ARE_FATAL |