/* check condition */
#define TBM_RETURN_IF_FAIL(cond) {\
if (!(cond)) {\
- TBM_ERR("'%s' failed.\n", #cond);\
+ TBM_ERR("'%s' failed.", #cond);\
return;\
} \
}
#define TBM_RETURN_VAL_IF_FAIL(cond, val) {\
if (!(cond)) {\
- TBM_ERR("'%s' failed.\n", #cond);\
+ TBM_ERR("'%s' failed.", #cond);\
return val;\
} \
}
#define TBM_GOTO_VAL_IF_FAIL(cond, val) {\
if (!(cond)) {\
- TBM_ERR("'%s' failed.\n", #cond);\
+ TBM_ERR("'%s' failed.", #cond);\
+ goto val;\
+ } \
+}
+
+#define TBM_RETURN_SET_ERR_IF_FAIL(cond, error, error_type) {\
+ if (!(cond)) {\
+ TBM_ERR("'%s' failed.", #cond);\
+ error = error_type;\
+ return;\
+ } \
+}
+
+#define TBM_RETURN_VAL_SET_ERR_IF_FAIL(cond, val, error, error_type) {\
+ if (!(cond)) {\
+ TBM_ERR("'%s' failed.", #cond);\
+ error = error_type;\
+ return val;\
+ } \
+}
+
+#define TBM_GOTO_VAL_SET_ERR_IF_FAIL(cond, val, error, error_type) {\
+ if (!(cond)) {\
+ TBM_ERR("'%s' failed.", #cond);\
+ error = error_type;\
goto val;\
} \
}