From: SooChan Lim Date: Fri, 11 Jun 2021 08:06:15 +0000 (+0900) Subject: tbm_log: add the condition check macro with error X-Git-Tag: submit/tizen/20210617.053259~27 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Flibtbm.git;a=commitdiff_plain;h=636fecdc2f08ad2b760a6d2d5500f252df260f94 tbm_log: add the condition check macro with error Change-Id: I064a9d7588a4d8ec0f02fa5da770b5c12c3bbcb6 --- diff --git a/include/tbm_log.h b/include/tbm_log.h index 9f724cc..d37c351 100644 --- a/include/tbm_log.h +++ b/include/tbm_log.h @@ -133,6 +133,22 @@ void tbm_log_print_stdout(int level, const char *fmt, ...); } \ } +#define TBM_RETURN_SET_ERR_IF_FAIL(cond, error, error_type) {\ + if (!(cond)) {\ + TBM_ERR("'%s' failed.\n", #cond);\ + error = error_type;\ + return;\ + } \ +} + +#define TBM_RETURN_VAL_SET_ERR_IF_FAIL(cond, val, error, error_type) {\ + if (!(cond)) {\ + TBM_ERR("'%s' failed.\n", #cond);\ + error = error_type;\ + return val;\ + } \ +} + #ifdef __cplusplus } #endif