[PATCH v2 6/6] lib: eliminate fprintf from _notmuch_message_file_open

2014-12-27 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 un-de

[PATCH v2 5/6] lib: replace almost all fprintfs in library with _n_d_log

2014-12-27 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 remaining fprintf will need an internal API change. --- lib/database.cc | 34 +- lib/directory.cc | 4 ++-- lib/index.cc | 1

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

2014-12-27 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 --- a/lib/message.cc

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

2014-12-27 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 | 15 +++ lib/notmuch-private.h | 4 2 files changed, 19 insertions(+) diff --git a/lib/database.cc b/l

[PATCH v2 2/6] lib/database: add field for last error string

2014-12-27 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 ind

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

2014-12-27 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 pass.

libnotmuch logging overhaul, round 2

2014-12-27 Thread David Bremner
This obsoletes id:1419615761-21581-1-git-send-email-david at tethera.net I added the promised "save a string in notmuch_database_t" logging backend, and ended up reorganizing things a bit, since the special casing required for _{create,open} a database seemed to naturally come first. One th

[PATCH v2 2/6] lib/database: add field for last error string

2014-12-27 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 ind

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

2014-12-27 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 pass.

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

2014-12-27 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 --- a/lib/message.cc

[PATCH v2 5/6] lib: replace almost all fprintfs in library with _n_d_log

2014-12-27 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 remaining fprintf will need an internal API change. --- lib/database.cc | 34 +- lib/directory.cc | 4 ++-- lib/index.cc | 1

[PATCH v2 6/6] lib: eliminate fprintf from _notmuch_message_file_open

2014-12-27 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 un-de

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

2014-12-27 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 | 15 +++ lib/notmuch-private.h | 4 2 files changed, 19 insertions(+) diff --git a/lib/database.cc b/l

libnotmuch logging overhaul, round 2

2014-12-27 Thread David Bremner
This obsoletes id:1419615761-21581-1-git-send-email-da...@tethera.net I added the promised "save a string in notmuch_database_t" logging backend, and ended up reorganizing things a bit, since the special casing required for _{create,open} a database seemed to naturally come first. One thing

[PATCH] emacs: Added "is:" style completion to notmuch-read-query.

2014-12-27 Thread David Bremner
From: Charles Celerier The notmuch-search-terms man page states that "tag:" is equivalent to "is:". Completion for "is:" style searches is now supported in the Emacs interface. Amended by David Bremner: combine lexical-let and let into lexical-let* --- emacs/notmuch.el | 16 +--- 1

[PATCH] lib: collapse computation of directory_id into a single expression

2014-12-27 Thread David Bremner
According to id:20141226113755.GA64154 at pamparam , the lifetime of (*i).c_str is only guaranteed for that line, so we extract the information we need in the same line. --- lib/message.cc | 9 - 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/message.cc b/lib/message.cc

Re: BUG: Using pointer that points to a destructed string's content

2014-12-27 Thread Tamas Szakaly
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 > > The following line is from _notmuch_message_add_directory_terms in > > lib/message.cc (line 652 in HEAD): > > > > direntry = (*i).c_str (); > > > > 'i' is a Xapian::TermIterator, whose operator* returns a std::string by > > value. > > This means t

[PATCH] emacs: Added "is:" style completion to notmuch-read-query.

2014-12-27 Thread David Bremner
From: Charles Celerier The notmuch-search-terms man page states that "tag:" is equivalent to "is:". Completion for "is:" style searches is now supported in the Emacs interface. Amended by David Bremner: combine lexical-let and let into lexical-let* --- emacs/notmuch.el | 16 +--- 1

[PATCH] lib: collapse computation of directory_id into a single expression

2014-12-27 Thread David Bremner
According to id:20141226113755.GA64154@pamparam , the lifetime of (*i).c_str is only guaranteed for that line, so we extract the information we need in the same line. --- lib/message.cc | 9 - 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/message.cc b/lib/message.cc ind

BUG: Using pointer that points to a destructed string's content

2014-12-27 Thread Tamas Szakaly
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 > > The following line is from _notmuch_message_add_directory_terms in > > lib/message.cc (line 652 in HEAD): > > > > direntry = (*i).c_str (); > > > > 'i' is a Xapian::TermIterator, whose operator* returns a std::string by > > value. > > This means t