VIR_CGROUP_BACKEND_CALL is exclusively used at the end
of a function, but it declares a variable.
Wrap it in a do..while block.
Signed-off-by: Ján Tomko <jtomko(a)redhat.com>
---
src/util/vircgroupbackend.h | 26 ++++++++++++++------------
1 file changed, 14 insertions(+), 12 deletions(-)
diff --git a/src/util/vircgroupbackend.h b/src/util/vircgroupbackend.h
index e12a2e8b9d..bcbe435d78 100644
--- a/src/util/vircgroupbackend.h
+++ b/src/util/vircgroupbackend.h
@@ -452,15 +452,17 @@ virCgroupBackendForController(virCgroupPtr group,
unsigned int controller);
#define VIR_CGROUP_BACKEND_CALL(group, controller, func, ret, ...) \
- virCgroupBackendPtr backend = virCgroupBackendForController(group, controller); \
- if (!backend) { \
- virReportError(VIR_ERR_INTERNAL_ERROR, \
- _("failed to get cgroup backend for '%s'"),
#func); \
- return ret; \
- } \
- if (!backend->func) { \
- virReportError(VIR_ERR_OPERATION_UNSUPPORTED, \
- _("operation '%s' not supported"), #func); \
- return ret; \
- } \
- return backend->func(group, ##__VA_ARGS__);
+ do { \
+ virCgroupBackendPtr backend = virCgroupBackendForController(group, controller);
\
+ if (!backend) { \
+ virReportError(VIR_ERR_INTERNAL_ERROR, \
+ _("failed to get cgroup backend for '%s'"),
#func); \
+ return ret; \
+ } \
+ if (!backend->func) { \
+ virReportError(VIR_ERR_OPERATION_UNSUPPORTED, \
+ _("operation '%s' not supported"), #func);
\
+ return ret; \
+ } \
+ return backend->func(group, ##__VA_ARGS__); \
+ } while (0)
--
2.26.2