trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jpe...@apache.org
Subject [2/2] trafficserver git commit: Fix tautological comparison in Vec.h
Date Thu, 13 Nov 2014 17:04:48 GMT
Fix tautological comparison in Vec.h

../../../lib/ts/Vec.h:188:18: error: comparison of unsigned expression >= 0 is always true
[-Werror,-Wtautological-compare]
  if (i < n && i >= 0)
                 ~ ^  ~

i is of type size_t which is unsigned, so it is always >= 0.


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/efec3eb6
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/efec3eb6
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/efec3eb6

Branch: refs/heads/master
Commit: efec3eb6fc83a93c77204ec9f907cef83b68e0e6
Parents: 6424aa9
Author: James Peach <jpeach@apache.org>
Authored: Thu Nov 13 08:56:44 2014 -0800
Committer: James Peach <jpeach@apache.org>
Committed: Thu Nov 13 08:56:44 2014 -0800

----------------------------------------------------------------------
 lib/ts/Vec.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/efec3eb6/lib/ts/Vec.h
----------------------------------------------------------------------
diff --git a/lib/ts/Vec.h b/lib/ts/Vec.h
index 47e017a..88c04c8 100644
--- a/lib/ts/Vec.h
+++ b/lib/ts/Vec.h
@@ -185,10 +185,11 @@ Vec<C,A,S>::Vec(C c) {
 
 template <class C, class A, int S> inline C
 Vec<C,A,S>::get(size_t i) const {
-  if (i < n && i >= 0)
+  if (i < n) {
     return v[i];
-  else
+  } else {
     return C();
+  }
 }
 
 template <class C, class A, int S> inline void 


Mime
View raw message