[libvirt] [PATCH 03/24] tests: hostdev: Declare count inside CHECK_LIST_COUNT()

Andrea Bolognani abologna at redhat.com
Tue Mar 8 10:04:58 UTC 2016


On Mon, 2016-03-07 at 13:18 -0500, Laine Stump wrote:
> > +# define CHECK_LIST_COUNT(list, cnt)                                        \
> > +    do {                                                                    \
> > +        int count;                                                          \
> > +        if ((count = virPCIDeviceListCount(list)) != cnt) {                 \
> > +            virReportError(VIR_ERR_INTERNAL_ERROR,                          \
> > +                           "Unexpected count of items in " #list ": %d, "   \
> > +                           "expecting %zu", count, (size_t) cnt);           \
> > +            goto cleanup;                                                   \
> > +        }                                                                   \
> > +    } while (0)
> 
> The only suggestion I would have is to make "count" something less 
> common, so that you're less likely to end up causing a compiler warning 
> later if someone adds a variable called "count" to a function that uses 
> this macro.
> 
> Otherwise ACK.

I changed it to 'actualCount' before pushing, and explained the
reason for the change in the commit message.

Cheers.

-- 
Andrea Bolognani
Software Engineer - Virtualization Team




More information about the libvir-list mailing list