[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen master] tools/xenstat: Avoid comparing '0 <= unsigned integer'
commit 9b0f436327c855546900c7fcf30e07aef9d4f2b0 Author: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> AuthorDate: Wed Apr 27 11:01:03 2016 +0100 Commit: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> CommitDate: Wed Apr 27 20:29:35 2016 +0100 tools/xenstat: Avoid comparing '0 <= unsigned integer' Clang points out that this is tautological. src/xenstat.c:325:8: warning: comparison of 0 <= unsigned expression is always true [-Wtautological-compare] if (0 <= index && index < node->num_domains) ~ ^ ~~~~~ Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> Acked-by: Wei Liu <wei.liu2@xxxxxxxxxx> Release-acked-by: Wei Liu <wei.liu2@xxxxxxxxxx> --- tools/xenstat/libxenstat/src/xenstat.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/xenstat/libxenstat/src/xenstat.c b/tools/xenstat/libxenstat/src/xenstat.c index 3495f3f..fbe44f3 100644 --- a/tools/xenstat/libxenstat/src/xenstat.c +++ b/tools/xenstat/libxenstat/src/xenstat.c @@ -322,7 +322,7 @@ xenstat_domain *xenstat_node_domain(xenstat_node * node, unsigned int domid) xenstat_domain *xenstat_node_domain_by_index(xenstat_node * node, unsigned int index) { - if (0 <= index && index < node->num_domains) + if (index < node->num_domains) return &(node->domains[index]); return NULL; } @@ -389,7 +389,7 @@ unsigned int xenstat_domain_num_vcpus(xenstat_domain * domain) xenstat_vcpu *xenstat_domain_vcpu(xenstat_domain * domain, unsigned int vcpu) { - if (0 <= vcpu && vcpu < domain->num_vcpus) + if (vcpu < domain->num_vcpus) return &(domain->vcpus[vcpu]); return NULL; } @@ -457,7 +457,7 @@ unsigned int xenstat_domain_num_networks(xenstat_domain * domain) xenstat_network *xenstat_domain_network(xenstat_domain * domain, unsigned int network) { - if (domain->networks && 0 <= network && network < domain->num_networks) + if (domain->networks && network < domain->num_networks) return &(domain->networks[network]); return NULL; } @@ -472,7 +472,7 @@ unsigned int xenstat_domain_num_vbds(xenstat_domain * domain) xenstat_vbd *xenstat_domain_vbd(xenstat_domain * domain, unsigned int vbd) { - if (domain->vbds && 0 <= vbd && vbd < domain->num_vbds) + if (domain->vbds && vbd < domain->num_vbds) return &(domain->vbds[vbd]); return NULL; } -- generated by git-patchbot for /home/xen/git/xen.git#master _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |