[PATCH] lib: update notmuch_tags_get example to reflect api change

Allan Wind allan_wind at lifeintegrity.com
Mon Jan 30 12:35:44 PST 2012


The function notmuch_database_find_message_by_filename now requires a
notmuch_message_t and returns a notmuch_status_t.  This
change was introduced with 02a3076711, LIBNOTMUCH_VERSION_MAJOR = 2,
version 0.9.
---
 lib/notmuch.h |   21 +++++++++++----------
 1 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/lib/notmuch.h b/lib/notmuch.h
index 7929fe7..5e6e449 100644
--- a/lib/notmuch.h
+++ b/lib/notmuch.h
@@ -941,21 +941,22 @@ notmuch_message_get_header (notmuch_message_t *message, const char *header);
  * Typical usage might be:
  *
  *     notmuch_message_t *message;
+ *     notmuch_status_t status;
  *     notmuch_tags_t *tags;
  *     const char *tag;
  *
- *     message = notmuch_database_find_message (database, message_id);
- *
- *     for (tags = notmuch_message_get_tags (message);
- *          notmuch_tags_valid (tags);
- *          notmuch_result_move_to_next (tags))
- *     {
- *         tag = notmuch_tags_get (tags);
- *         ....
+ *     status = notmuch_database_find_message (database, message_id, &message);
+ *     if (!status && message) {
+ *          for (tags = notmuch_message_get_tags (message);
+ *               notmuch_tags_valid (tags);
+ *               notmuch_result_move_to_next (tags))
+ *          {
+ *               tag = notmuch_tags_get (tags);
+ *               ....
+ *          }
+ *          notmuch_message_destroy (message);
  *     }
  *
- *     notmuch_message_destroy (message);
- *
  * Note that there's no explicit destructor needed for the
  * notmuch_tags_t object. (For consistency, we do provide a
  * notmuch_tags_destroy function, but there's no good reason to call
-- 
1.7.2.5



More information about the notmuch mailing list