mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-11-16 18:15:17 +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
10
src/common.c
10
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];
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user