Introduce pipeline *_RET macros

This simplifies code by allowing to express programmer intent
explicitly and helps to avoid missing return statements (this patch
fixes at least one bug related to this).

Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
This commit is contained in:
Robert Baldyga
2019-05-02 16:21:55 +02:00
parent 1373471af7
commit c2aea209db
5 changed files with 135 additions and 250 deletions

View File

@@ -131,4 +131,23 @@ void ocf_pipeline_next(ocf_pipeline_t pipeline);
void ocf_pipeline_finish(ocf_pipeline_t pipeline, int error);
#define OCF_PL_NEXT_RET(pipeline) ({ \
ocf_pipeline_next(pipeline); \
return; \
})
#define OCF_PL_FINISH_RET(pipeline, error) ({ \
ocf_pipeline_finish(pipeline, error); \
return; \
})
#define OCF_PL_NEXT_ON_SUCCESS_RET(pipeline, error) ({ \
if (error) \
ocf_pipeline_finish(pipeline, error); \
else \
ocf_pipeline_next(pipeline); \
return; \
})
#endif /* __UTILS_PIPELINE_H__ */