From: SooChan Lim Date: Tue, 11 May 2021 23:37:40 +0000 (+0900) Subject: tbm_surface_internal: add some error log macros X-Git-Tag: submit/tizen/20210531.033615~4 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Flibtbm.git;a=commitdiff_plain;h=8a70e0854cc728e4f7a9ad9cc635b518a2d6348d tbm_surface_internal: add some error log macros this macros deals with the tbm_error types when a condition is failed. Change-Id: Ie458e7b84b3d39565a5b535dac7beac111330e51 --- diff --git a/src/tbm_surface_internal.c b/src/tbm_surface_internal.c index 50d108c..18a922c 100644 --- a/src/tbm_surface_internal.c +++ b/src/tbm_surface_internal.c @@ -57,6 +57,25 @@ void _tbm_surface_mutex_unlock(void); } \ } +#define TBM_SURFACE_RETURN_ERR_IF_FAIL(cond, error_type) {\ + if (!(cond)) {\ + TBM_ERR("'%s' failed.\n", #cond);\ + _tbm_set_last_result(error_type);\ + _tbm_surface_mutex_unlock();\ + return;\ + } \ +} + +#define TBM_SURFACE_RETURN_SET_ERR_IF_FAIL(cond, error, error_type) {\ + if (!(cond)) {\ + TBM_ERR("'%s' failed.\n", #cond);\ + error = error_type;\ + _tbm_set_last_result(error_type);\ + _tbm_surface_mutex_unlock();\ + return;\ + } \ +} + #define TBM_SURFACE_RETURN_VAL_IF_FAIL(cond, val) {\ if (!(cond)) {\ TBM_ERR("'%s' failed.\n", #cond);\ @@ -66,6 +85,26 @@ void _tbm_surface_mutex_unlock(void); } \ } + +#define TBM_SURFACE_RETURN_VAL_ERR_IF_FAIL(cond, val, error_type) {\ + if (!(cond)) {\ + TBM_ERR("'%s' failed.\n", #cond);\ + _tbm_set_last_result(error_type);\ + _tbm_surface_mutex_unlock();\ + return val;\ + } \ +} + +#define TBM_SURFACE_RETURN_VAL_SET_ERR_IF_FAIL(cond, val, error, error_type) {\ + if (!(cond)) {\ + TBM_ERR("'%s' failed.\n", #cond);\ + error = error_type;\ + _tbm_set_last_result(error_type);\ + _tbm_surface_mutex_unlock();\ + return val;\ + } \ +} + /* LCOV_EXCL_START */ static double _tbm_surface_internal_get_time(void)