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>
}
/* 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];
}
}