mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-22 10:58:10 +01:00
cli: use designated initializer to initialize add_files_state
The side effect is that all of add_files_state will be initialized to zero, removing any lingering doubt that some of it might not be initialized. It's not a small struct, and the initialization is scattered around a bit, so this makes the code more readable.
This commit is contained in:
parent
8b35b8f71a
commit
847792ec29
1 changed files with 5 additions and 8 deletions
|
@ -933,7 +933,11 @@ int
|
||||||
notmuch_new_command (notmuch_config_t *config, int argc, char *argv[])
|
notmuch_new_command (notmuch_config_t *config, int argc, char *argv[])
|
||||||
{
|
{
|
||||||
notmuch_database_t *notmuch;
|
notmuch_database_t *notmuch;
|
||||||
add_files_state_t add_files_state;
|
add_files_state_t add_files_state = {
|
||||||
|
.verbosity = VERBOSITY_NORMAL,
|
||||||
|
.debug = FALSE,
|
||||||
|
.output_is_a_tty = isatty (fileno (stdout)),
|
||||||
|
};
|
||||||
struct timeval tv_start;
|
struct timeval tv_start;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
@ -948,10 +952,6 @@ notmuch_new_command (notmuch_config_t *config, int argc, char *argv[])
|
||||||
notmuch_bool_t quiet = FALSE, verbose = FALSE;
|
notmuch_bool_t quiet = FALSE, verbose = FALSE;
|
||||||
notmuch_status_t status;
|
notmuch_status_t status;
|
||||||
|
|
||||||
add_files_state.verbosity = VERBOSITY_NORMAL;
|
|
||||||
add_files_state.debug = FALSE;
|
|
||||||
add_files_state.output_is_a_tty = isatty (fileno (stdout));
|
|
||||||
|
|
||||||
notmuch_opt_desc_t options[] = {
|
notmuch_opt_desc_t options[] = {
|
||||||
{ NOTMUCH_OPT_BOOLEAN, &quiet, "quiet", 'q', 0 },
|
{ NOTMUCH_OPT_BOOLEAN, &quiet, "quiet", 'q', 0 },
|
||||||
{ NOTMUCH_OPT_BOOLEAN, &verbose, "verbose", 'v', 0 },
|
{ NOTMUCH_OPT_BOOLEAN, &verbose, "verbose", 'v', 0 },
|
||||||
|
@ -1086,9 +1086,6 @@ notmuch_new_command (notmuch_config_t *config, int argc, char *argv[])
|
||||||
talloc_free (dot_notmuch_path);
|
talloc_free (dot_notmuch_path);
|
||||||
dot_notmuch_path = NULL;
|
dot_notmuch_path = NULL;
|
||||||
|
|
||||||
add_files_state.processed_files = 0;
|
|
||||||
add_files_state.added_messages = 0;
|
|
||||||
add_files_state.removed_messages = add_files_state.renamed_messages = 0;
|
|
||||||
gettimeofday (&add_files_state.tv_start, NULL);
|
gettimeofday (&add_files_state.tv_start, NULL);
|
||||||
|
|
||||||
add_files_state.removed_files = _filename_list_create (config);
|
add_files_state.removed_files = _filename_list_create (config);
|
||||||
|
|
Loading…
Reference in a new issue