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;
}