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

Michal Prívozník mprivozn at redhat.com
Wed Jul 4 06:21:01 UTC 2018


On 07/04/2018 04:31 AM, Marcos Paulo de Souza wrote:
> This macro avoids code duplication when checking for arrays of objects.
> 
> Signed-off-by: Marcos Paulo de Souza <marcos.souza.org at gmail.com>
> ---
> 
>  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) \

There needs to be a space between # and define (just line in context
lines above). There has to be one space for every level of nesting.

> +    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 {
> 

Michal




More information about the libvir-list mailing list