]>
Commit | Line | Data |
---|---|---|
fe8ab488 A |
1 | #ifndef __FAIL_H_ |
2 | #define __FAIL_H_ | |
3 | ||
4 | #define TOSTRING_HELPER(x) #x | |
5 | #define TOSTRING(x) TOSTRING_HELPER(x) | |
6 | ||
7 | #define PERFINDEX_FAILURE -1 | |
8 | #define PERFINDEX_SUCCESS 0 | |
9 | ||
10 | extern char* error_str; | |
11 | ||
12 | #define FAIL(message) do {\ | |
13 | error_str = message " at " __FILE__ ": " TOSTRING(__LINE__);\ | |
14 | return PERFINDEX_FAILURE;\ | |
15 | } while(0) | |
16 | ||
17 | #define VERIFY(condition, fail_message) do {\ | |
18 | if(!(condition)) FAIL(fail_message);\ | |
19 | } while(0) | |
20 | ||
21 | #endif |