[PATCH -v2 1/2] esx_util.h: Add ESX_VI_CHECK_ARG_LIST macro

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This macro avoids code duplication when checking for arrays of objects.

Signed-off-by: Marcos Paulo de Souza <marcos.souza.org@xxxxxxxxx>
---

 Changes from v1:
 * Change VIR_ERR_INVALID_ARG to VIR_ERR_INTERNAL_ERROR (Michal)
 * Change esxVI_checkArgList to ESX_VI_CHECK_ARG_LIST (Matthias)

 src/esx/esx_util.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/esx/esx_util.h b/src/esx/esx_util.h
index c6f14bb2d9..63602bf3cb 100644
--- a/src/esx/esx_util.h
+++ b/src/esx/esx_util.h
@@ -26,6 +26,14 @@
 # include "internal.h"
 # include "viruri.h"
 
+#define ESX_VI_CHECK_ARG_LIST(val) \
+    do { \
+        if (!val || *val) { \
+            virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); \
+            return -1; \
+        } \
+    } while (0)
+
 typedef struct _esxUtil_ParsedUri esxUtil_ParsedUri;
 
 struct _esxUtil_ParsedUri {
-- 
2.17.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux