From: Marcos Paulo de Souza Date: Wed, 4 Jul 2018 02:31:22 +0000 (-0300) Subject: esx_util.h: Add ESX_VI_CHECK_ARG_LIST macro X-Git-Tag: v4.6.0-rc1~318 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=03212ab9255b86fb9fbc91bd6dca25bbb63f5d21;p=thirdparty%2Flibvirt.git 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 --- 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 {