From 5ad0019b2326e4012299e36682669ca767f39cd4 Mon Sep 17 00:00:00 2001 From: Lars Henriksen Date: Thu, 23 Aug 2018 20:45:38 +0200 Subject: Only reload if data files were changed (replacement) This is a replacement for commits 57dd3d6 and 912124b. The idea is to move the check for modified files and the list initialization into io_load_data(), and let io_load_data() decide what to load. A new argument is used to force a load. The return code from new_data() (the renamed version of io_check_data_files_modified()) tells which files have changed. Signed-off-by: Lars Henriksen Signed-off-by: Lukas Fleischer --- src/args.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src/args.c') diff --git a/src/args.c b/src/args.c index 60de7da..9e22d8d 100644 --- a/src/args.c +++ b/src/args.c @@ -738,7 +738,7 @@ int parse_args(int argc, char **argv) io_check_file(path_todo); io_check_file(path_conf); config_load(); /* To get output date format. */ - io_load_data(&filter); + io_load_data(&filter, FORCE); if (grep_filter) { io_save_todo(path_todo); io_save_apts(path_apts); @@ -760,7 +760,7 @@ int parse_args(int argc, char **argv) io_check_file(path_todo); io_check_file(path_conf); config_load(); /* To get output date format. */ - io_load_data(&filter); + io_load_data(&filter, FORCE); /* Use default values for non-specified format strings. */ fmt_apt = fmt_apt ? fmt_apt : " - %S -> %E\n\t%m\n"; @@ -779,13 +779,12 @@ int parse_args(int argc, char **argv) } else if (gc) { io_check_file(path_apts); io_check_file(path_todo); - io_load_data(NULL); + io_load_data(NULL, FORCE); note_gc(); } else if (import) { io_check_file(path_apts); io_check_file(path_todo); - /* Get default pager in case we need to show a log file. */ - io_load_data(NULL); + io_load_data(NULL, FORCE); if (dump_imported) { /* * Use default values for non-specified format strings. @@ -809,7 +808,7 @@ int parse_args(int argc, char **argv) } else if (export) { io_check_file(path_apts); io_check_file(path_todo); - io_load_data(&filter); + io_load_data(&filter, FORCE); io_export_data(xfmt, export_uid); } else if (daemon) { notify_init_vars(); -- cgit v1.2.3-54-g00ecf