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:
@@ -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__ */
|
||||
|
Reference in New Issue
Block a user