tbm_log: add the condition check macro with error
[platform/core/uifw/libtbm.git] / include / tbm_log.h
index 9f724cc..d37c351 100644 (file)
@@ -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