Unverified Commit 0be127e0 by Tobin C. Harding Committed by Christian Brauner

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: 's avatarTobin C. Harding <me@tobin.cc>
parent fddd112c
...@@ -707,7 +707,6 @@ static char *get_nic_if_avail(int fd, struct alloted_s *names, int pid, ...@@ -707,7 +707,6 @@ static char *get_nic_if_avail(int fd, struct alloted_s *names, int pid,
char nicname[IFNAMSIZ]; char nicname[IFNAMSIZ];
struct stat sb; struct stat sb;
struct alloted_s *n; struct alloted_s *n;
int count = 0;
char *buf = NULL; char *buf = NULL;
for (n = names; n != NULL; n = n->next) 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, ...@@ -735,6 +734,8 @@ static char *get_nic_if_avail(int fd, struct alloted_s *names, int pid,
owner = NULL; owner = NULL;
for (n = names; n != NULL; n = n->next) { for (n = names; n != NULL; n = n->next) {
int count;
count = count_entries(buf, sb.st_size, n->name, intype, br); count = count_entries(buf, sb.st_size, n->name, intype, br);
if (count >= n->allowed) if (count >= n->allowed)
continue; continue;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment