From ff72a55691d5d193ab76f82314d0f7ad1319a6f8 Mon Sep 17 00:00:00 2001 From: Nikos Ntarmos Date: Thu, 28 May 2009 16:43:15 +0300 Subject: [PATCH] No need to check for loop variable value If the first for-loop succedds in finding the desired interface, it will return to its caller. The only way we drop to the second for-loop is if nothing is found thus far, so no need to check for (i == 16). Signed-off-by: Nikos Ntarmos Signed-off-by: Brenden Matthews --- src/common.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/common.c b/src/common.c index 8430d0cf..7c3b0172 100644 --- a/src/common.c +++ b/src/common.c @@ -195,12 +195,10 @@ struct net_stat *get_net_stat(const char *dev) } /* wasn't found? add it */ - if (i == 16) { - for (i = 0; i < 16; i++) { - if (netstats[i].dev == 0) { - netstats[i].dev = strndup(dev, text_buffer_size); - return &netstats[i]; - } + for (i = 0; i < 16; i++) { + if (netstats[i].dev == 0) { + netstats[i].dev = strndup(dev, text_buffer_size); + return &netstats[i]; } }