[libvirt] [PATCH 1/8] qemu: bulk stats: extend internal collection API
Wang Rui
moon.wangrui at huawei.com
Wed Sep 10 08:08:01 UTC 2014
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;
}
More information about the libvir-list
mailing list