diff options
author | Jani Nikula <jani@nikula.org> | 2014-01-19 22:32:25 +0200 |
---|---|---|
committer | David Bremner <david@tethera.net> | 2014-01-26 09:41:29 -0400 |
commit | f849b371cc78fac73d9a8e0467bc0e6232ced18b (patch) | |
tree | 946bbcc44cb4fbd75a29d8c590a53fb8c6b6eb61 /notmuch-new.c | |
parent | 0b247cb411fa7530003bad920bd2c85ed46187b5 (diff) |
cli: for loop is more customary
With the happy day stop condition within the while, it was
confusing. Switch to the paradigm for loop. No functional changes.
Diffstat (limited to 'notmuch-new.c')
-rw-r--r-- | notmuch-new.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/notmuch-new.c b/notmuch-new.c index e6ca8414..f6d9c3a4 100644 --- a/notmuch-new.c +++ b/notmuch-new.c @@ -704,8 +704,7 @@ count_files (const char *path, int *count, add_files_state_t *state) char *next; struct dirent **fs_entries = NULL; int num_fs_entries = scandir (path, &fs_entries, 0, dirent_sort_inode); - int entry_type; - int i = 0; + int entry_type, i; if (num_fs_entries == -1) { fprintf (stderr, "Warning: failed to open directory %s: %s\n", @@ -713,11 +712,8 @@ count_files (const char *path, int *count, add_files_state_t *state) goto DONE; } - while (!interrupted) { - if (i == num_fs_entries) - break; - - entry = fs_entries[i++]; + for (i = 0; i < num_fs_entries && ! interrupted; i++) { + entry = fs_entries[i]; /* Ignore special directories to avoid infinite recursion. * Also ignore the .notmuch directory and files/directories |