Message ID | 20230628233813.6564-6-stephen@networkplumber.org (mailing list archive) |
---|---|
State | Accepted |
Commit | bbfccc11e1c4399f46921365b36807c3791be536 |
Delegated to: | David Ahern |
Headers | show |
Series | Warning fixes | expand |
Context | Check | Description |
---|---|---|
netdev/tree_selection | success | Not a local patch |
Stephen Hemminger <stephen@networkplumber.org> writes: > Gcc with warnings enabled complains because the conditional. > if ((long)(a - b) < 0) > could be construed as never true. Hmm, yeah, it would never be true where sizeof(long) > 4. > Change to simple comparison. > > Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> Reviewed-by: Petr Machata <me@pmachata.org>
diff --git a/misc/ifstat.c b/misc/ifstat.c index 4ce5ca8af4e7..f6f9ba5027d3 100644 --- a/misc/ifstat.c +++ b/misc/ifstat.c @@ -608,7 +608,7 @@ static void update_db(int interval) int i; for (i = 0; i < MAXS; i++) { - if ((long)(h1->ival[i] - n->ival[i]) < 0) { + if (h1->ival[i] < n->ival[i]) { memset(n->ival, 0, sizeof(n->ival)); break; }
Gcc with warnings enabled complains because the conditional. if ((long)(a - b) < 0) could be construed as never true. Change to simple comparison. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- misc/ifstat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)