tbm_log: add the condition check macro with error 83/259883/1
authorSooChan Lim <sc1.lim@samsung.com>
Fri, 11 Jun 2021 08:06:15 +0000 (17:06 +0900)
committerSooChan Lim <sc1.lim@samsung.com>
Tue, 15 Jun 2021 09:01:50 +0000 (18:01 +0900)
Change-Id: I064a9d7588a4d8ec0f02fa5da770b5c12c3bbcb6

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