Error checking macros. More...
Go to the source code of this file.
Macros | |
| #define | EC_INIT int ret = 0 |
| #define | EC_STATUS(a) |
| #define | EC_EXIT_STATUS(a) |
| #define | EC_FAIL do { ret = -1; goto cleanup; } while (0) |
| #define | EC_FAIL_LOG(...) |
| #define | EC_CLEANUP cleanup |
| #define | EC_EXIT return ret |
| #define | EC_ZERO_LOG(a) |
| #define | EC_ZERO_LOGSTR(a, b, ...) |
| #define | EC_ZERO_LOG_ERR(a, b) |
| #define | EC_ZERO(a) |
| #define | EC_ZERO_ERR(a, b) |
| #define | EC_NEG1_LOG(a) |
| #define | EC_NEG1_LOGSTR(a, b, ...) |
| #define | EC_NEG1_LOG_ERR(a, b) |
| #define | EC_NEG1(a) |
| #define | EC_NULL_LOG(a) |
| #define | EC_NULL_LOGSTR(a, b, ...) |
| #define | EC_NULL_LOG_ERR(a, b) |
| #define | EC_NULL(a) |
Error checking macros.
We have these macros:
A boileplate function template is:
| #define EC_CLEANUP cleanup |
| #define EC_EXIT return ret |
| #define EC_EXIT_STATUS | ( | a | ) |
| #define EC_FAIL do { ret = -1; goto cleanup; } while (0) |
| #define EC_FAIL_LOG | ( | ... | ) |
| #define EC_INIT int ret = 0 |
| #define EC_NEG1 | ( | a | ) |
| #define EC_NEG1_LOG | ( | a | ) |
check for return val 0 which is ok, every other is an error, prints errno
| #define EC_NEG1_LOG_ERR | ( | a, | |
| b ) |
| #define EC_NEG1_LOGSTR | ( | a, | |
| b, | |||
| ... ) |
| #define EC_NULL | ( | a | ) |
| #define EC_NULL_LOG | ( | a | ) |
check for return val != NULL, prints errno
| #define EC_NULL_LOG_ERR | ( | a, | |
| b ) |
| #define EC_NULL_LOGSTR | ( | a, | |
| b, | |||
| ... ) |
| #define EC_STATUS | ( | a | ) |
| #define EC_ZERO | ( | a | ) |
| #define EC_ZERO_ERR | ( | a, | |
| b ) |
| #define EC_ZERO_LOG | ( | a | ) |
check for return val 0 which is ok, every other is an error, prints errno
| #define EC_ZERO_LOG_ERR | ( | a, | |
| b ) |
| #define EC_ZERO_LOGSTR | ( | a, | |
| b, | |||
| ... ) |