cmd: Reduce scope of 'count' variable

Variable is used in one plaice only within a nested statement block.
The code is cleaner if the variable is declared near where it is used.
Found using cppcheck.

Reduce the scope of 'count' variable.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
This commit is contained in:
Tobin C. Harding 2018-08-20 16:31:33 +10:00
parent ba464e9b66
commit aac44dc4ff

View File

@ -707,7 +707,6 @@ static char *get_nic_if_avail(int fd, struct alloted_s *names, int pid,
char nicname[IFNAMSIZ];
struct stat sb;
struct alloted_s *n;
int count = 0;
char *buf = NULL;
for (n = names; n != NULL; n = n->next)
@ -735,6 +734,8 @@ static char *get_nic_if_avail(int fd, struct alloted_s *names, int pid,
owner = NULL;
for (n = names; n != NULL; n = n->next) {
int count;
count = count_entries(buf, sb.st_size, n->name, intype, br);
if (count >= n->allowed)
continue;