Notmuch and backups

2021-03-06 Thread Matt Armstrong
David Bremner writes: [...] > +case NOTMUCH_CONFIG_BACKUP_DIR: > + return "database.backup_dir"; [...] David, your recent changes that allow configurable separation of the mail store and .notmuch files look like good ideas to me. Separately, I've recently set up backups of my system

[PATCH] run uncrustify.

2021-03-06 Thread David Bremner
This is mainly fixing up style problems that crept in with the first merged config handling series. It also takes a few other suggestions from uncrustify as this makes it easier to detect future style problems. --- this is on top of id:20210306134934.491249-1-da...@tethera.net lib/config.cc

[PATCH 1/4] lib/open: use local talloc context in n_d_create_with_config

2021-03-06 Thread David Bremner
This better matches the memory allocation semantics in notmuch_database_open_with_config. --- lib/open.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/open.cc b/lib/open.cc index 3b86065b..3b66d2eb 100644 --- a/lib/open.cc +++ b/lib/open.cc @@ -423,6 +423,7 @@

[PATCH 3/4] lib/config: free memory from traversing GKeyFile

2021-03-06 Thread David Bremner
This fixes a few small memory leaks. --- lib/config.cc | 17 - 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/lib/config.cc b/lib/config.cc index 948751bc..6ace6e52 100644 --- a/lib/config.cc +++ b/lib/config.cc @@ -330,7 +330,7 @@ _notmuch_config_load_from_file

[PATCH 2/4] lib/open: free value from g_key_file_get_value

2021-03-06 Thread David Bremner
This fixes a small memory leak. --- lib/open.cc | 16 +++- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/lib/open.cc b/lib/open.cc index 3b66d2eb..b424fa0c 100644 --- a/lib/open.cc +++ b/lib/open.cc @@ -153,7 +153,8 @@ DONE: } static notmuch_status_t

[PATCH 4/4] lib/open: free GKeyFile

2021-03-06 Thread David Bremner
This fixes a small-to-medium (depending on size of config file) memory leak. --- lib/open.cc | 6 ++ 1 file changed, 6 insertions(+) diff --git a/lib/open.cc b/lib/open.cc index b424fa0c..a5211746 100644 --- a/lib/open.cc +++ b/lib/open.cc @@ -372,6 +372,9 @@

Clean up glib / GKeyFile memory use

2021-03-06 Thread David Bremner
It turns out I was too optimistic / lazy about how the g_key_file API manages memory. None of the resulting memory leaks are large (unless you somehow keep War and Peace in your config file), but it is more tidy to clean them up, and makes it easier to spot more significant leaks in the already