]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
esx_util.h: Add ESX_VI_CHECK_ARG_LIST macro
authorMarcos Paulo de Souza <marcos.souza.org@gmail.com>
Wed, 4 Jul 2018 02:31:22 +0000 (23:31 -0300)
committerMichal Privoznik <mprivozn@redhat.com>
Wed, 4 Jul 2018 06:17:41 +0000 (08:17 +0200)
This macro avoids code duplication when checking for arrays of objects.

Signed-off-by: Marcos Paulo de Souza <marcos.souza.org@gmail.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
src/esx/esx_util.h

index c6f14bb2d95c63b37aab4da467aa02fbbbaf2896..df246445d2cd7cde3f0dfb45ac592b42a9b44880 100644 (file)
 # 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 {