| @@ -38,14 +38,6 @@ | |||
| #include "framework/common/ge_inner_error_codes.h" | |||
| #include "mmpa/mmpa_api.h" | |||
| #define GE_CHECK_POSITIVE_SIZE_RANGE(size) \ | |||
| do { \ | |||
| if (size <= 0) { \ | |||
| DOMI_LOGE("param[%s] is not a positive number", #size); \ | |||
| return PARAM_INVALID; \ | |||
| } \ | |||
| } while (0) | |||
| #define CHECK_FALSE_EXEC(expr, exec_expr, ...) \ | |||
| { \ | |||
| bool b = (expr); \ | |||
| @@ -121,84 +113,75 @@ | |||
| } while (0) | |||
| // Check if the parameter is null. If yes, return PARAM_INVALID and record the error | |||
| #define GE_CHECK_NOTNULL(val) \ | |||
| do { \ | |||
| if (val == nullptr) { \ | |||
| DOMI_LOGE("param[%s] must not be null.", #val); \ | |||
| return ge::PARAM_INVALID; \ | |||
| } \ | |||
| #define GE_CHECK_NOTNULL(val) \ | |||
| do { \ | |||
| if (val == nullptr) { \ | |||
| DOMI_LOGE("param[%s] must not be null.", #val); \ | |||
| return ge::PARAM_INVALID; \ | |||
| } \ | |||
| } while (0) | |||
| // Check if the parameter is null. If yes, just return and record the error | |||
| #define GE_CHECK_NOTNULL_JUST_RETURN(val) \ | |||
| do { \ | |||
| if (val == nullptr) { \ | |||
| DOMI_LOGE("param[%s] must not be null.", #val); \ | |||
| return; \ | |||
| } \ | |||
| #define GE_CHECK_NOTNULL_JUST_RETURN(val) \ | |||
| do { \ | |||
| if (val == nullptr) { \ | |||
| DOMI_LOGE("param[%s] must not be null.", #val); \ | |||
| return; \ | |||
| } \ | |||
| } while (0) | |||
| // Check whether the parameter is null. If so, execute the exec_expr expression and record the error log | |||
| #define GE_CHECK_NOTNULL_EXEC(val, exec_expr) \ | |||
| do { \ | |||
| if (val == nullptr) { \ | |||
| DOMI_LOGE("param[%s] must not be null.", #val); \ | |||
| exec_expr; \ | |||
| } \ | |||
| #define GE_CHECK_NOTNULL_EXEC(val, exec_expr) \ | |||
| do { \ | |||
| if (val == nullptr) { \ | |||
| DOMI_LOGE("param[%s] must not be null.", #val); \ | |||
| exec_expr; \ | |||
| } \ | |||
| } while (0) | |||
| // Check whether the parameter is null. If yes, return directly and record the error log | |||
| #define GE_RT_VOID_CHECK_NOTNULL(val) \ | |||
| do { \ | |||
| if (val == nullptr) { \ | |||
| DOMI_LOGE("param[%s] must not be null.", #val); \ | |||
| return; \ | |||
| } \ | |||
| #define GE_RT_VOID_CHECK_NOTNULL(val) \ | |||
| do { \ | |||
| if (val == nullptr) { \ | |||
| DOMI_LOGE("param[%s] must not be null.", #val); \ | |||
| return; \ | |||
| } \ | |||
| } while (0) | |||
| // Check if the parameter is null. If yes, return false and record the error log | |||
| #define GE_RT_FALSE_CHECK_NOTNULL(val) \ | |||
| do { \ | |||
| if (val == nullptr) { \ | |||
| DOMI_LOGE("param[%s] must not be null.", #val); \ | |||
| return false; \ | |||
| } \ | |||
| #define GE_RT_FALSE_CHECK_NOTNULL(val) \ | |||
| do { \ | |||
| if (val == nullptr) { \ | |||
| DOMI_LOGE("param[%s] must not be null.", #val); \ | |||
| return false; \ | |||
| } \ | |||
| } while (0) | |||
| // Check if the parameter is out of bounds | |||
| #define GE_CHECK_SIZE(size) \ | |||
| do { \ | |||
| if (size == 0) { \ | |||
| DOMI_LOGE("param[%s] is out of range", #size); \ | |||
| return ge::PARAM_INVALID; \ | |||
| } \ | |||
| } while (0) | |||
| // Check if the container is empty | |||
| #define GE_CHECK_VECTOR_NOT_EMPTY(vector) \ | |||
| do { \ | |||
| if (vector.empty()) { \ | |||
| DOMI_LOGE("param[%s] is empty!", #vector); \ | |||
| return ge::FAILED; \ | |||
| } \ | |||
| #define GE_CHECK_SIZE(size) \ | |||
| do { \ | |||
| if (size == 0) { \ | |||
| DOMI_LOGE("param[%s] is out of range", #size); \ | |||
| return ge::PARAM_INVALID; \ | |||
| } \ | |||
| } while (0) | |||
| // Check if the value on the left is greater than or equal to the value on the right | |||
| #define GE_CHECK_GE(lhs, rhs) \ | |||
| do { \ | |||
| if (lhs < rhs) { \ | |||
| DOMI_LOGE("param[%s] is less than[%s]", #lhs, #rhs); \ | |||
| return ge::PARAM_INVALID; \ | |||
| } \ | |||
| #define GE_CHECK_GE(lhs, rhs) \ | |||
| do { \ | |||
| if (lhs < rhs) { \ | |||
| DOMI_LOGE("param[%s] is less than[%s]", #lhs, #rhs); \ | |||
| return ge::PARAM_INVALID; \ | |||
| } \ | |||
| } while (0) | |||
| // Check if the value on the left is less than or equal to the value on the right | |||
| #define GE_CHECK_LE(lhs, rhs) \ | |||
| do { \ | |||
| if (lhs > rhs) { \ | |||
| DOMI_LOGE("param[%s] is greater than[%s]", #lhs, #rhs); \ | |||
| return ge::PARAM_INVALID; \ | |||
| } \ | |||
| #define GE_CHECK_LE(lhs, rhs) \ | |||
| do { \ | |||
| if (lhs > rhs) { \ | |||
| DOMI_LOGE("param[%s] is greater than[%s]", #lhs, #rhs); \ | |||
| return ge::PARAM_INVALID; \ | |||
| } \ | |||
| } while (0) | |||
| #define GE_DELETE_NEW_SINGLE(var) \ | |||