[libvirt] [PATCH 5/7] util: Add ADD_ARG_RETURN_ON_ERROR

Fabiano Fidêncio fidencio at redhat.com
Thu Jan 2 14:05:20 UTC 2020


[snip]

> > +#define ADD_ARG_RETURN_ON_ERROR(rule, str) \
> > +    do { \
> > +        if (VIR_RESIZE_N(rule->args, \
> > +                         rule->argsAlloc, \
> > +                         rule->argsLen, 1) < 0) \
> > +            return; \
> > + \
> > +        rule->args[rule->argsLen++] = g_strdup(str); \
> > +    } while (0)
>
> IMHO this is missing the benefit of using glib since VIR_RESIZE_N
> will never fail now. We should get rid of "ADD_ARG" entirely, and
> just put a g_realloc() call directly in the place it is needed
> without any macros. Likewise for the next patch.

Cool, I really missed that.
I'll submit a v2, soon.

Best Regards,
-- 
Fabiano Fidêncio.





More information about the libvir-list mailing list