[hackers] [slstatus] num_files: Variable declarations at top of block || Aaron Marcher
commit 0a287616b2e3122a1b149e28d63560819bcdf7c9
Author: Aaron Marcher <me_AT_drkhsh.at>
AuthorDate: Mon May 7 12:17:13 2018 +0200
Commit: Aaron Marcher <me_AT_drkhsh.at>
CommitDate: Mon May 7 12:17:13 2018 +0200
num_files: Variable declarations at top of block
diff --git a/components/num_files.c b/components/num_files.c
index ab43694..327a64d 100644
--- a/components/num_files.c
+++ b/components/num_files.c
_AT_@ -11,13 +11,14 @@ num_files(const char *dir)
{
struct dirent *dp;
DIR *fd;
- int num = 0;
+ int num;
if (!(fd = opendir(dir))) {
fprintf(stderr, "opendir '%s': %s\n", dir, strerror(errno));
return NULL;
}
+ num = 0;
while ((dp = readdir(fd))) {
if (!strcmp(dp->d_name, ".") || !strcmp(dp->d_name, "..")) {
continue; /* skip self and parent */
Received on Mon May 07 2018 - 12:25:50 CEST
This archive was generated by hypermail 2.3.0
: Mon May 07 2018 - 12:36:24 CEST