[PATCH] lib: another iterator-temporary/stale-pointer bug

2014-12-28 Thread David Bremner
Tamas Szakaly points out [1] that the bug fixed in 51b073c still exists in at least one place. This change follows the suggestion of [2] and creates a block scope temporary std::string to avoid the rules of iterators temporaries. [1]: id:20141226113755.GA64154@pamparam [2]:

libnotmuch logging overhaul v3

2014-12-28 Thread David Bremner
changes since the last round [1] - remove unused variable - fix the internal usage of n_d_open to use _verbose version - revert the hiding of query debugging. [1]: id:1419717937-1108-2-git-send-email-da...@tethera.net diff --git a/lib/database.cc b/lib/database.cc index 16cd940..b144885 100644

[Patch v3 4/6] lib: add private function to extract the database for a message.

2014-12-28 Thread David Bremner
This is needed by logging in functions outside message.cc that take only a notmuch_message_t object. --- lib/message.cc| 6 ++ lib/notmuch-private.h | 2 ++ 2 files changed, 8 insertions(+) diff --git a/lib/message.cc b/lib/message.cc index a7a13cc..43cc078 100644 ---

[Patch v3 2/6] lib/database: add field for last error string

2014-12-28 Thread David Bremner
The idea is to have a logging function setting this string instead of printing to stderr. --- lib/database-private.h | 4 lib/database.cc| 7 +++ lib/notmuch.h | 7 +++ 3 files changed, 18 insertions(+) diff --git a/lib/database-private.h b/lib/database-private.h

[Patch v3 6/6] lib: eliminate fprintf from _notmuch_message_file_open

2014-12-28 Thread David Bremner
You may wonder why _notmuch_message_file_open_ctx has two parameters. This is because we need sometime to use a ctx which is a notmuch_message_t. While we could get the database from this, there is no easy way in C to tell type we are getting. The remaining fprintf is removed by Jani's series

[Patch v3 1/6] lib: add verbose versions of notmuch_database_{open,create}

2014-12-28 Thread David Bremner
This has the the non-trivial side effect silencing all output to stderror from these two routines. The stdargs based infrastucture will be used in following commits for a more general logging mechanism. The changes to notmuch-{new,search} and test/symbol-test are just to make the test suite

[Patch v3 3/6] lib: add a log function with output to a string in notmuch_database_t

2014-12-28 Thread David Bremner
This is a thin wrapper around the previously implemented string logging infrastructure. In the future it could have more configurable output options. --- lib/database.cc | 14 ++ lib/notmuch-private.h | 4 2 files changed, 18 insertions(+) diff --git a/lib/database.cc

[Patch v3 5/6] lib: replace almost all fprintfs in library with _n_d_log

2014-12-28 Thread David Bremner
This is not supposed to change any functionality from an end user point of view. Note that it will eliminate some output to stderr. The query debugging output is left as is; it doesn't really fit with the current primitive logging model. The remaining bad fprintf will need an internal API change.

Re: Solaris 11 anyone?

2014-12-28 Thread jsdckr
Thanks so much for your response, David. I've used notmuch for years, and really appreciate it (and rely on it!). The switch to solaris has deprived me... the problems are purely around the build dependencies. All the best Jamie On Wed, Dec 24, 2014 at 01:28:14PM -0700, David Bremner-2 [via

[PATCH] lib: another iterator-temporary/stale-pointer bug

2014-12-28 Thread David Bremner
Tamas Szakaly points out [1] that the bug fixed in 51b073c still exists in at least one place. This change follows the suggestion of [2] and creates a block scope temporary std::string to avoid the rules of iterators temporaries. [1]: id:20141226113755.GA64154 at pamparam [2]:

libnotmuch logging overhaul v3

2014-12-28 Thread David Bremner
changes since the last round [1] - remove unused variable - fix the internal usage of n_d_open to use _verbose version - revert the hiding of query debugging. [1]: id:1419717937-1108-2-git-send-email-david at tethera.net diff --git a/lib/database.cc b/lib/database.cc index 16cd940..b144885

[Patch v3 4/6] lib: add private function to extract the database for a message.

2014-12-28 Thread David Bremner
This is needed by logging in functions outside message.cc that take only a notmuch_message_t object. --- lib/message.cc| 6 ++ lib/notmuch-private.h | 2 ++ 2 files changed, 8 insertions(+) diff --git a/lib/message.cc b/lib/message.cc index a7a13cc..43cc078 100644 ---

[Patch v3 6/6] lib: eliminate fprintf from _notmuch_message_file_open

2014-12-28 Thread David Bremner
You may wonder why _notmuch_message_file_open_ctx has two parameters. This is because we need sometime to use a ctx which is a notmuch_message_t. While we could get the database from this, there is no easy way in C to tell type we are getting. The remaining fprintf is removed by Jani's series

[Patch v3 2/6] lib/database: add field for last error string

2014-12-28 Thread David Bremner
The idea is to have a logging function setting this string instead of printing to stderr. --- lib/database-private.h | 4 lib/database.cc| 7 +++ lib/notmuch.h | 7 +++ 3 files changed, 18 insertions(+) diff --git a/lib/database-private.h b/lib/database-private.h

[Patch v3 1/6] lib: add "verbose" versions of notmuch_database_{open,create}

2014-12-28 Thread David Bremner
This has the the non-trivial side effect silencing all output to stderror from these two routines. The stdargs based infrastucture will be used in following commits for a more general logging mechanism. The changes to notmuch-{new,search} and test/symbol-test are just to make the test suite

[Patch v3 3/6] lib: add a log function with output to a string in notmuch_database_t

2014-12-28 Thread David Bremner
This is a thin wrapper around the previously implemented string logging infrastructure. In the future it could have more configurable output options. --- lib/database.cc | 14 ++ lib/notmuch-private.h | 4 2 files changed, 18 insertions(+) diff --git a/lib/database.cc

[Patch v3 5/6] lib: replace almost all fprintfs in library with _n_d_log

2014-12-28 Thread David Bremner
This is not supposed to change any functionality from an end user point of view. Note that it will eliminate some output to stderr. The query debugging output is left as is; it doesn't really fit with the current primitive logging model. The remaining "bad" fprintf will need an internal API