These were defined in adu.c but not used there at all.
In fact, create.c only used num_dirs in scan_dir() as a counter for
the directory currently being processed while the other two were not
really used at all. Make num_dirs local to scan_dir(), rename it to
current_dir_num and remove the other two.
The only "real" users of these variables are all in select.c, so move
them there and make them static.
/** Command line and config file options. */
struct gengetopt_args_info conf;
-/** Global dir count. */
-uint64_t num_dirs = 0;
-/** Global files count. */
-uint64_t num_files = 0;
-/** Global bytes count. */
-uint64_t num_bytes = 0;
-
/** The number of different uids found so far. */
uint32_t num_uids = 0;
extern uint32_t num_uids;
extern struct osl_table *dir_table;
-extern uint64_t num_dirs;
-extern uint64_t num_files;
-extern uint64_t num_bytes;
extern struct gengetopt_args_info conf;
/* adu.c */
struct dirent *entry;
int ret, cwd_fd, ret2;
uint64_t dir_size = 0, dir_files = 0;
- uint64_t this_dir_num = ++num_dirs;
+ /* dir count. */
+ static uint64_t current_dir_num;
+
+ uint64_t this_dir_num = ++current_dir_num;
check_signals();
- DEBUG_LOG("----------------- %llu: %s\n", (long long unsigned)num_dirs, dirname);
+ DEBUG_LOG("----------------- %llu: %s\n", (long long unsigned)current_dir_num, dirname);
ret = adu_opendir(dirname, &dir, &cwd_fd);
if (ret < 0) {
if (ret != -ERRNO_TO_ERROR(EACCES))
/* regular file */
size = s.st_size;
dir_size += size;
- num_bytes += size;
dir_files++;
- num_files++;
uid = s.st_uid;
ret = search_uid(uid, CREATE_USER_TABLE | OPEN_USER_TABLE, &ui);
if (ret < 0)
#include "error.h"
#include "portable_io.h"
+/** Global dir count. */
+static uint64_t num_dirs;
+/** Global files count. */
+static uint64_t num_files;
+/** Global bytes count. */
+static uint64_t num_bytes;
+
/** The decimal representation of an uint64_t never exceeds that size. */
#define FORMATED_VALUE_SIZE 25