Error checking macros.
More...
Go to the source code of this file.
|
| #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.
- See also
- ./doc/developer/developer.md
We have these macros:
#define EC_NEG1_LOG(a)
Definition errchk.h:105
#define EC_ZERO_LOG_ERR(a, b)
Definition errchk.h:79
#define EC_NULL_LOG(a)
Definition errchk.h:141
#define EC_NEG1_LOG_ERR(a, b)
Definition errchk.h:123
#define EC_ZERO(a)
Definition errchk.h:88
#define EC_NULL_LOGSTR(a, b,...)
Definition errchk.h:150
#define EC_NEG1_LOGSTR(a, b,...)
Definition errchk.h:114
#define EC_NEG1(a)
Definition errchk.h:132
#define EC_ZERO_LOGSTR(a, b,...)
Definition errchk.h:70
#define EC_ZERO_LOG(a)
Definition errchk.h:61
#define EC_NULL_LOG_ERR(a, b)
Definition errchk.h:159
#define EC_NULL(a)
Definition errchk.h:168
A boileplate function template is:
int func(void)
{
...your code here...
}
#define EC_CLEANUP
Definition errchk.h:28
#define EC_INIT
Definition errchk.h:18
#define EC_EXIT
Definition errchk.h:29
#define EC_STATUS(a)
Definition errchk.h:19
◆ EC_CLEANUP
| #define EC_CLEANUP cleanup |
◆ EC_EXIT
| #define EC_EXIT return ret |
◆ EC_EXIT_STATUS
| #define EC_EXIT_STATUS |
( |
| a | ) |
|
Value:do { ret = (a); goto cleanup; } while (0)
◆ EC_FAIL
| #define EC_FAIL do { ret = -1; goto cleanup; } while (0) |
◆ EC_FAIL_LOG
| #define EC_FAIL_LOG |
( |
| ... | ) |
|
Value: do { \
ret = -1; \
goto cleanup; \
} while (0)
@ logtype_default
Definition logger.h:34
@ log_error
Definition logger.h:20
◆ EC_INIT
| #define EC_INIT int ret = 0 |
◆ EC_NEG1
Value: do { \
if ((a) == -1) { \
ret = -1; \
goto cleanup; \
} \
} while (0)
◆ EC_NEG1_LOG
Value: do { \
if ((a) == -1) { \
ret = -1; \
goto cleanup; \
} \
} while (0)
check for return val 0 which is ok, every other is an error, prints errno
◆ EC_NEG1_LOG_ERR
| #define EC_NEG1_LOG_ERR |
( |
| a, |
|
|
| b ) |
Value: do { \
if ((a) == -1) { \
ret = b; \
goto cleanup; \
} \
} while (0)
◆ EC_NEG1_LOGSTR
| #define EC_NEG1_LOGSTR |
( |
| a, |
|
|
| b, |
|
|
| ... ) |
Value: do { \
if ((a) == -1) { \
ret = -1; \
goto cleanup; \
} \
} while (0)
◆ EC_NULL
Value: do { \
if ((a) == NULL) { \
ret = -1; \
goto cleanup; \
} \
} while (0)
◆ EC_NULL_LOG
Value: do { \
if ((a) == NULL) { \
ret = -1; \
goto cleanup; \
} \
} while (0)
check for return val != NULL, prints errno
◆ EC_NULL_LOG_ERR
| #define EC_NULL_LOG_ERR |
( |
| a, |
|
|
| b ) |
Value: do { \
if ((a) == NULL) { \
ret = b; \
goto cleanup; \
} \
} while (0)
◆ EC_NULL_LOGSTR
| #define EC_NULL_LOGSTR |
( |
| a, |
|
|
| b, |
|
|
| ... ) |
Value: do { \
if ((a) == NULL) { \
ret = -1; \
goto cleanup; \
} \
} while (0)
◆ EC_STATUS
◆ EC_ZERO
Value: do { \
if ((a) != 0) { \
ret = -1; \
goto cleanup; \
} \
} while (0)
◆ EC_ZERO_ERR
| #define EC_ZERO_ERR |
( |
| a, |
|
|
| b ) |
Value: do { \
if ((a) != 0) { \
ret = b; \
goto cleanup; \
} \
} while (0)
◆ EC_ZERO_LOG
Value: do { \
if ((a) != 0) { \
ret = -1; \
goto cleanup; \
} \
} while (0)
check for return val 0 which is ok, every other is an error, prints errno
◆ EC_ZERO_LOG_ERR
| #define EC_ZERO_LOG_ERR |
( |
| a, |
|
|
| b ) |
Value: do { \
if ((a) != 0) { \
ret = (b); \
goto cleanup; \
} \
} while (0)
◆ EC_ZERO_LOGSTR
| #define EC_ZERO_LOGSTR |
( |
| a, |
|
|
| b, |
|
|
| ... ) |
Value: do { \
if ((a) != 0) { \
ret = -1; \
goto cleanup; \
} \
} while (0)