lander/ltm/include/ltm/common.h

34 lines
1.3 KiB
C

#ifndef LTM_COMMON
#define LTM_COMMON
#define LTM_RES(x) \
{ \
ltm_err res = x; \
if (res != ltm_err_ok) \
return res; \
}
#define LTM_RES2(x, e) \
{ \
ltm_err res = x; \
if (res != ltm_err_ok) { \
e; \
return res; \
} \
}
#define LTM_MIN(x, y) ((x) < (y) ? (x) : (y))
#define LTM_MAX(x, y) ((x) > (y) ? (x) : (y))
typedef enum ltm_err {
ltm_err_ok = 0,
ltm_err_invalid_template,
ltm_err_failed_alloc,
ltm_err_failed_io,
ltm_err_not_found,
ltm_err_wrong_block_type,
ltm_err_done,
} ltm_err;
#endif