mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-11-17 02:25:09 +00:00
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 <ntarmos@cs.uoi.gr> Signed-off-by: Brenden Matthews <brenden@rty.ca>
This commit is contained in:
parent
33451a9420
commit
ff72a55691
@ -195,14 +195,12 @@ struct net_stat *get_net_stat(const char *dev)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* wasn't found? add it */
|
/* wasn't found? add it */
|
||||||
if (i == 16) {
|
|
||||||
for (i = 0; i < 16; i++) {
|
for (i = 0; i < 16; i++) {
|
||||||
if (netstats[i].dev == 0) {
|
if (netstats[i].dev == 0) {
|
||||||
netstats[i].dev = strndup(dev, text_buffer_size);
|
netstats[i].dev = strndup(dev, text_buffer_size);
|
||||||
return &netstats[i];
|
return &netstats[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
CRIT_ERR("too many interfaces used (limit is 16)");
|
CRIT_ERR("too many interfaces used (limit is 16)");
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user