[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH 1/8] qemu: bulk stats: extend internal collection API



On 2014/9/8 21:05, Francesco Romani wrote:
> +static bool
> +qemuDomainGetStatsNeedMonitor(unsigned int stats)
> +{
> +    size_t i;
> +
> +    for (i = 0; qemuDomainGetStatsWorkers[i].func; i++)
> +        if (stats & qemuDomainGetStatsWorkers[i].stats)
> +            if (qemuDomainGetStatsWorkers[i].monitor)
> +                return true;
> +
> +    return false;
> +}

'stats' is not necessary in the loop.

How about this style?

static bool
qemuDomainGetStatsNeedMonitor(unsigned int stats)
{
    size_t i;

    if (!stats)
        return false;

    for (i = 0; qemuDomainGetStatsWorkers[i].func; i++)
        if (qemuDomainGetStatsWorkers[i].stats &&
            qemuDomainGetStatsWorkers[i].monitor)
            return true;

    return false;
}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]