From 03212ab9255b86fb9fbc91bd6dca25bbb63f5d21 Mon Sep 17 00:00:00 2001 From: Marcos Paulo de Souza Date: Tue, 3 Jul 2018 23:31:22 -0300 Subject: [PATCH] esx_util.h: Add ESX_VI_CHECK_ARG_LIST macro This macro avoids code duplication when checking for arrays of objects. Signed-off-by: Marcos Paulo de Souza Signed-off-by: Michal Privoznik --- 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..df246445d2 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 {