]> git.cworth.org Git - notmuch/commitdiff
lib: Rename iterator functions to prepare for reverse iteration.
authorCarl Worth <cworth@cworth.org>
Tue, 9 Mar 2010 17:22:29 +0000 (09:22 -0800)
committerCarl Worth <cworth@cworth.org>
Tue, 9 Mar 2010 17:22:29 +0000 (09:22 -0800)
We rename 'has_more' to 'valid' so that it can function whether
iterating in a forward or reverse direction. We also rename
'advance' to 'move_to_next' to setup parallel naming with
the proposed functions 'move_to_first', 'move_to_last', and
'move_to_previous'.

17 files changed:
lib/database.cc
lib/directory.cc
lib/message.cc
lib/messages.c
lib/notmuch-private.h
lib/notmuch.h
lib/query.cc
lib/tags.c
lib/thread.cc
notmuch-dump.c
notmuch-new.c
notmuch-reply.c
notmuch-restore.c
notmuch-search-tags.c
notmuch-search.c
notmuch-show.c
notmuch-tag.c

index 2b5b64dffd9bf0499a0ca70534eba115366610b3..88c85ed49494c1f23eb7737c0f2daef0e109cc17 100644 (file)
@@ -751,8 +751,8 @@ notmuch_database_upgrade (notmuch_database_t *notmuch,
        total = notmuch_query_count_messages (query);
 
        for (messages = notmuch_query_search_messages (query);
-            notmuch_messages_has_more (messages);
-            notmuch_messages_advance (messages))
+            notmuch_messages_valid (messages);
+            notmuch_messages_move_to_next (messages))
        {
            if (do_progress_notify) {
                progress_notify (closure, (double) count / total);
@@ -827,8 +827,8 @@ notmuch_database_upgrade (notmuch_database_t *notmuch,
        char *filename;
 
        for (messages = notmuch_query_search_messages (query);
-            notmuch_messages_has_more (messages);
-            notmuch_messages_advance (messages))
+            notmuch_messages_valid (messages);
+            notmuch_messages_move_to_next (messages))
        {
            if (do_progress_notify) {
                progress_notify (closure, (double) count / total);
index bb6314ad7610b992726c8396251df1b64fa32606..5e75b73eb5cfea02d2c7796ae0cd7de7dccf125e 100644 (file)
@@ -79,7 +79,7 @@ _notmuch_filenames_create (void *ctx,
 }
 
 notmuch_bool_t
-notmuch_filenames_has_more (notmuch_filenames_t *filenames)
+notmuch_filenames_valid (notmuch_filenames_t *filenames)
 {
     if (filenames == NULL)
        return NULL;
@@ -105,7 +105,7 @@ notmuch_filenames_get (notmuch_filenames_t *filenames)
 }
 
 void
-notmuch_filenames_advance (notmuch_filenames_t *filenames)
+notmuch_filenames_move_to_next (notmuch_filenames_t *filenames)
 {
     if (filenames == NULL)
        return;
index 01950505900f8d161701883b5b7a5e7dc5e67d26..0f98222d36a128283c2774e805a6af69f11f0228 100644 (file)
@@ -739,8 +739,8 @@ notmuch_message_remove_all_tags (notmuch_message_t *message)
        return status;
 
     for (tags = notmuch_message_get_tags (message);
-        notmuch_tags_has_more (tags);
-        notmuch_tags_advance (tags))
+        notmuch_tags_valid (tags);
+        notmuch_tags_move_to_next (tags))
     {
        tag = notmuch_tags_get (tags);
 
index aa92535fa26ff3c3c750af43a5a2aab5aad543c4..db2b7a16eab2c7d715dbf75f4d8b839cb248546a 100644 (file)
@@ -102,13 +102,13 @@ _notmuch_messages_create (notmuch_message_list_t *list)
  *        anyway. *sigh*
  */
 notmuch_bool_t
-notmuch_messages_has_more (notmuch_messages_t *messages)
+notmuch_messages_valid (notmuch_messages_t *messages)
 {
     if (messages == NULL)
        return FALSE;
 
     if (! messages->is_of_list_type)
-       return _notmuch_mset_messages_has_more (messages);
+       return _notmuch_mset_messages_valid (messages);
 
     return (messages->iterator != NULL);
 }
@@ -126,10 +126,10 @@ notmuch_messages_get (notmuch_messages_t *messages)
 }
 
 void
-notmuch_messages_advance (notmuch_messages_t *messages)
+notmuch_messages_move_to_next (notmuch_messages_t *messages)
 {
     if (! messages->is_of_list_type)
-       return _notmuch_mset_messages_advance (messages);
+       return _notmuch_mset_messages_move_to_next (messages);
 
     if (messages->iterator == NULL)
        return;
@@ -162,11 +162,11 @@ notmuch_messages_collect_tags (notmuch_messages_t *messages)
        msg_tags = notmuch_message_get_tags (msg);
        while ((tag = notmuch_tags_get (msg_tags))) {
            g_hash_table_insert (htable, xstrdup (tag), NULL);
-           notmuch_tags_advance (msg_tags);
+           notmuch_tags_move_to_next (msg_tags);
        }
        notmuch_tags_destroy (msg_tags);
        notmuch_message_destroy (msg);
-       notmuch_messages_advance (messages);
+       notmuch_messages_move_to_next (messages);
     }
 
     keys = g_hash_table_get_keys (htable);
index c7fb0ef89312fa35ffda1cee7f22a9cd08da30c3..d52d84d41ad1055b379dba19a7100e09fcbbd823 100644 (file)
@@ -382,13 +382,13 @@ _notmuch_messages_create (notmuch_message_list_t *list);
 /* query.cc */
 
 notmuch_bool_t
-_notmuch_mset_messages_has_more (notmuch_messages_t *messages);
+_notmuch_mset_messages_valid (notmuch_messages_t *messages);
 
 notmuch_message_t *
 _notmuch_mset_messages_get (notmuch_messages_t *messages);
 
 void
-_notmuch_mset_messages_advance (notmuch_messages_t *messages);
+_notmuch_mset_messages_move_to_next (notmuch_messages_t *messages);
 
 /* message.cc */
 
index d3e50a79536c37283e3cd42fc74b5e7c79ad1d88..479a1dcd3195a886aece90e555f869811f1374b5 100644 (file)
@@ -364,8 +364,8 @@ notmuch_query_set_sort (notmuch_query_t *query, notmuch_sort_t sort);
  *     query = notmuch_query_create (database, query_string);
  *
  *     for (threads = notmuch_query_search_threads (query);
- *          notmuch_threads_has_more (threads);
- *          notmuch_threads_advance (threads))
+ *          notmuch_threads_valid (threads);
+ *          notmuch_threads_move_to_next (threads))
  *     {
  *         thread = notmuch_threads_get (threads);
  *         ....
@@ -403,8 +403,8 @@ notmuch_query_search_threads (notmuch_query_t *query);
  *     query = notmuch_query_create (database, query_string);
  *
  *     for (messages = notmuch_query_search_messages (query);
- *          notmuch_messages_has_more (messages);
- *          notmuch_messages_advance (messages))
+ *          notmuch_messages_valid (messages);
+ *          notmuch_messages_move_to_next (messages))
  *     {
  *         message = notmuch_messages_get (messages);
  *         ....
@@ -439,18 +439,17 @@ notmuch_query_search_messages (notmuch_query_t *query);
 void
 notmuch_query_destroy (notmuch_query_t *query);
 
-/* Does the given notmuch_threads_t object contain any more
- * results.
+/* Is the given 'threads' iterator pointing at a valid thread.
  *
- * When this function returns TRUE, notmuch_threads_get will
- * return a valid object. Whereas when this function returns FALSE,
+ * When this function returns TRUE, notmuch_threads_get will return a
+ * valid object. Whereas when this function returns FALSE,
  * notmuch_threads_get will return NULL.
  *
  * See the documentation of notmuch_query_search_threads for example
  * code showing how to iterate over a notmuch_threads_t object.
  */
 notmuch_bool_t
-notmuch_threads_has_more (notmuch_threads_t *threads);
+notmuch_threads_valid (notmuch_threads_t *threads);
 
 /* Get the current thread from 'threads' as a notmuch_thread_t.
  *
@@ -466,13 +465,13 @@ notmuch_threads_has_more (notmuch_threads_t *threads);
 notmuch_thread_t *
 notmuch_threads_get (notmuch_threads_t *threads);
 
-/* Advance the 'threads' iterator to the next thread.
+/* Move the 'threads' iterator to the next thread.
  *
  * See the documentation of notmuch_query_search_threads for example
  * code showing how to iterate over a notmuch_threads_t object.
  */
 void
-notmuch_threads_advance (notmuch_threads_t *threads);
+notmuch_threads_move_to_next (notmuch_threads_t *threads);
 
 /* Destroy a notmuch_threads_t object.
  *
@@ -593,8 +592,8 @@ notmuch_thread_get_newest_date (notmuch_thread_t *thread);
  *     thread = notmuch_threads_get (threads);
  *
  *     for (tags = notmuch_thread_get_tags (thread);
- *          notmuch_tags_has_more (tags);
- *          notmuch_result_advance (tags))
+ *          notmuch_tags_valid (tags);
+ *          notmuch_result_move_to_next (tags))
  *     {
  *         tag = notmuch_tags_get (tags);
  *         ....
@@ -614,8 +613,7 @@ notmuch_thread_get_tags (notmuch_thread_t *thread);
 void
 notmuch_thread_destroy (notmuch_thread_t *thread);
 
-/* Does the given notmuch_messages_t object contain any more
- * messages.
+/* Is the given 'messages' iterator pointing at a valid message.
  *
  * When this function returns TRUE, notmuch_messages_get will return a
  * valid object. Whereas when this function returns FALSE,
@@ -625,7 +623,7 @@ notmuch_thread_destroy (notmuch_thread_t *thread);
  * code showing how to iterate over a notmuch_messages_t object.
  */
 notmuch_bool_t
-notmuch_messages_has_more (notmuch_messages_t *messages);
+notmuch_messages_valid (notmuch_messages_t *messages);
 
 /* Get the current message from 'messages' as a notmuch_message_t.
  *
@@ -641,13 +639,13 @@ notmuch_messages_has_more (notmuch_messages_t *messages);
 notmuch_message_t *
 notmuch_messages_get (notmuch_messages_t *messages);
 
-/* Advance the 'messages' iterator to the next result.
+/* Move the 'messages' iterator to the next message.
  *
  * See the documentation of notmuch_query_search_messages for example
  * code showing how to iterate over a notmuch_messages_t object.
  */
 void
-notmuch_messages_advance (notmuch_messages_t *messages);
+notmuch_messages_move_to_next (notmuch_messages_t *messages);
 
 /* Destroy a notmuch_messages_t object.
  *
@@ -715,7 +713,7 @@ notmuch_message_get_thread_id (notmuch_message_t *message);
  * will return NULL.
  *
  * If there are no replies to 'message', this function will return
- * NULL. (Note that notmuch_messages_has_more will accept that NULL
+ * NULL. (Note that notmuch_messages_valid will accept that NULL
  * value as legitimate, and simply return FALSE for it.)
  */
 notmuch_messages_t *
@@ -792,8 +790,8 @@ notmuch_message_get_header (notmuch_message_t *message, const char *header);
  *     message = notmuch_database_find_message (database, message_id);
  *
  *     for (tags = notmuch_message_get_tags (message);
- *          notmuch_tags_has_more (tags);
- *          notmuch_result_advance (tags))
+ *          notmuch_tags_valid (tags);
+ *          notmuch_result_move_to_next (tags))
  *     {
  *         tag = notmuch_tags_get (tags);
  *         ....
@@ -934,7 +932,7 @@ notmuch_message_thaw (notmuch_message_t *message);
 void
 notmuch_message_destroy (notmuch_message_t *message);
 
-/* Does the given notmuch_tags_t object contain any more tags.
+/* Is the given 'tags' iterator pointing at a valid tag.
  *
  * When this function returns TRUE, notmuch_tags_get will return a
  * valid string. Whereas when this function returns FALSE,
@@ -944,7 +942,7 @@ notmuch_message_destroy (notmuch_message_t *message);
  * showing how to iterate over a notmuch_tags_t object.
  */
 notmuch_bool_t
-notmuch_tags_has_more (notmuch_tags_t *tags);
+notmuch_tags_valid (notmuch_tags_t *tags);
 
 /* Get the current tag from 'tags' as a string.
  *
@@ -957,13 +955,13 @@ notmuch_tags_has_more (notmuch_tags_t *tags);
 const char *
 notmuch_tags_get (notmuch_tags_t *tags);
 
-/* Advance the 'tags' iterator to the next tag.
+/* Move the 'tags' iterator to the next tag.
  *
  * See the documentation of notmuch_message_get_tags for example code
  * showing how to iterate over a notmuch_tags_t object.
  */
 void
-notmuch_tags_advance (notmuch_tags_t *tags);
+notmuch_tags_move_to_next (notmuch_tags_t *tags);
 
 /* Destroy a notmuch_tags_t object.
  *
@@ -1042,8 +1040,7 @@ notmuch_directory_get_child_directories (notmuch_directory_t *directory);
 void
 notmuch_directory_destroy (notmuch_directory_t *directory);
 
-/* Does the given notmuch_filenames_t object contain any more
- * filenames.
+/* Is the given 'filenames' iterator pointing at a valid filename.
  *
  * When this function returns TRUE, notmuch_filenames_get will return
  * a valid string. Whereas when this function returns FALSE,
@@ -1053,7 +1050,7 @@ notmuch_directory_destroy (notmuch_directory_t *directory);
  * function will always return FALSE.
  */
 notmuch_bool_t
-notmuch_filenames_has_more (notmuch_filenames_t *filenames);
+notmuch_filenames_valid (notmuch_filenames_t *filenames);
 
 /* Get the current filename from 'filenames' as a string.
  *
@@ -1066,13 +1063,13 @@ notmuch_filenames_has_more (notmuch_filenames_t *filenames);
 const char *
 notmuch_filenames_get (notmuch_filenames_t *filenames);
 
-/* Advance the 'filenames' iterator to the next filename.
+/* Move the 'filenames' iterator to the next filename.
  *
  * It is acceptable to pass NULL for 'filenames', in which case this
  * function will do nothing.
  */
 void
-notmuch_filenames_advance (notmuch_filenames_t *filenames);
+notmuch_filenames_move_to_next (notmuch_filenames_t *filenames);
 
 /* Destroy a notmuch_filenames_t object.
  *
index 2c8d167255bb903a5224d6d5b7ba0408e108bd00..9266d35f8fc517dbda11d3be9f68a0b47f7105da 100644 (file)
@@ -170,7 +170,7 @@ notmuch_query_search_messages (notmuch_query_t *query)
 }
 
 notmuch_bool_t
-_notmuch_mset_messages_has_more (notmuch_messages_t *messages)
+_notmuch_mset_messages_valid (notmuch_messages_t *messages)
 {
     notmuch_mset_messages_t *mset_messages;
 
@@ -189,7 +189,7 @@ _notmuch_mset_messages_get (notmuch_messages_t *messages)
 
     mset_messages = (notmuch_mset_messages_t *) messages;
 
-    if (! _notmuch_mset_messages_has_more (&mset_messages->base))
+    if (! _notmuch_mset_messages_valid (&mset_messages->base))
        return NULL;
 
     doc_id = *mset_messages->iterator;
@@ -208,7 +208,7 @@ _notmuch_mset_messages_get (notmuch_messages_t *messages)
 }
 
 void
-_notmuch_mset_messages_advance (notmuch_messages_t *messages)
+_notmuch_mset_messages_move_to_next (notmuch_messages_t *messages)
 {
     notmuch_mset_messages_t *mset_messages;
 
@@ -258,14 +258,14 @@ notmuch_query_destroy (notmuch_query_t *query)
 }
 
 notmuch_bool_t
-notmuch_threads_has_more (notmuch_threads_t *threads)
+notmuch_threads_valid (notmuch_threads_t *threads)
 {
     notmuch_message_t *message;
 
     if (threads->thread_id)
        return TRUE;
 
-    while (notmuch_messages_has_more (threads->messages))
+    while (notmuch_messages_valid (threads->messages))
     {
        message = notmuch_messages_get (threads->messages);
 
@@ -277,11 +277,11 @@ notmuch_threads_has_more (notmuch_threads_t *threads)
        {
            g_hash_table_insert (threads->threads,
                                 xstrdup (threads->thread_id), NULL);
-           notmuch_messages_advance (threads->messages);
+           notmuch_messages_move_to_next (threads->messages);
            return TRUE;
        }
 
-       notmuch_messages_advance (threads->messages);
+       notmuch_messages_move_to_next (threads->messages);
     }
 
     threads->thread_id = NULL;
@@ -291,7 +291,7 @@ notmuch_threads_has_more (notmuch_threads_t *threads)
 notmuch_thread_t *
 notmuch_threads_get (notmuch_threads_t *threads)
 {
-    if (! notmuch_threads_has_more (threads))
+    if (! notmuch_threads_valid (threads))
        return NULL;
 
     return _notmuch_thread_create (threads->query,
@@ -301,7 +301,7 @@ notmuch_threads_get (notmuch_threads_t *threads)
 }
 
 void
-notmuch_threads_advance (notmuch_threads_t *threads)
+notmuch_threads_move_to_next (notmuch_threads_t *threads)
 {
     threads->thread_id = NULL;
 }
index 85507e91fc35da13b52b1b82b2bcbe2a71af8f83..8fe4a3f0d4ebae5575f2e08abd5825781dbc1396 100644 (file)
@@ -77,7 +77,8 @@ _notmuch_tags_add_tag (notmuch_tags_t *tags, const char *tag)
  *
  * The internal creator of 'tags' should call this function before
  * returning 'tags' to the user to call the public functions such as
- * notmuch_tags_has_more, notmuch_tags_get, and notmuch_tags_advance. */
+ * notmuch_tags_valid, notmuch_tags_get, and
+ * notmuch_tags_move_to_next. */
 void
 _notmuch_tags_prepare_iterator (notmuch_tags_t *tags)
 {
@@ -89,7 +90,7 @@ _notmuch_tags_prepare_iterator (notmuch_tags_t *tags)
 }
 
 notmuch_bool_t
-notmuch_tags_has_more (notmuch_tags_t *tags)
+notmuch_tags_valid (notmuch_tags_t *tags)
 {
     return tags->iterator != NULL;
 }
@@ -104,7 +105,7 @@ notmuch_tags_get (notmuch_tags_t *tags)
 }
 
 void
-notmuch_tags_advance (notmuch_tags_t *tags)
+notmuch_tags_move_to_next (notmuch_tags_t *tags)
 {
     if (tags->iterator == NULL)
        return;
index 321937b0ac3315be803473debbc4d475736d7a23..ec80f8518b9ebe7856db7a5a78cea474baf53e9f 100644 (file)
@@ -119,8 +119,8 @@ _thread_add_message (notmuch_thread_t *thread,
     }
 
     for (tags = notmuch_message_get_tags (message);
-        notmuch_tags_has_more (tags);
-        notmuch_tags_advance (tags))
+        notmuch_tags_valid (tags);
+        notmuch_tags_move_to_next (tags))
     {
        tag = notmuch_tags_get (tags);
        g_hash_table_insert (thread->tags, xstrdup (tag), NULL);
@@ -269,8 +269,8 @@ _notmuch_thread_create (void *ctx,
     notmuch_query_set_sort (thread_id_query, NOTMUCH_SORT_OLDEST_FIRST);
 
     for (messages = notmuch_query_search_messages (thread_id_query);
-        notmuch_messages_has_more (messages);
-        notmuch_messages_advance (messages))
+        notmuch_messages_valid (messages);
+        notmuch_messages_move_to_next (messages))
     {
        message = notmuch_messages_get (messages);
        _thread_add_message (thread, message);
@@ -280,8 +280,8 @@ _notmuch_thread_create (void *ctx,
     notmuch_query_destroy (thread_id_query);
 
     for (messages = notmuch_query_search_messages (matched_query);
-        notmuch_messages_has_more (messages);
-        notmuch_messages_advance (messages))
+        notmuch_messages_valid (messages);
+        notmuch_messages_move_to_next (messages))
     {
        message = notmuch_messages_get (messages);
        _thread_add_matched_message (thread, message);
index ea326bb672efb89a27ab33c62235c5a7f51ea008..7e7bc177ed4995a00c993b773a6630e39a97473c 100644 (file)
@@ -59,8 +59,8 @@ notmuch_dump_command (unused (void *ctx), int argc, char *argv[])
     }
 
     for (messages = notmuch_query_search_messages (query);
-        notmuch_messages_has_more (messages);
-        notmuch_messages_advance (messages))
+        notmuch_messages_valid (messages);
+        notmuch_messages_move_to_next (messages))
     {
        int first = 1;
        message = notmuch_messages_get (messages);
@@ -69,8 +69,8 @@ notmuch_dump_command (unused (void *ctx), int argc, char *argv[])
                 "%s (", notmuch_message_get_message_id (message));
 
        for (tags = notmuch_message_get_tags (message);
-            notmuch_tags_has_more (tags);
-            notmuch_tags_advance (tags))
+            notmuch_tags_valid (tags);
+            notmuch_tags_move_to_next (tags))
        {
            if (! first)
                fprintf (output, " ");
index f25c71f3450f686eae1c50b9d4ed8f9cf55c6959..44b50aaa2c49ceea06825abea39256790f2c1a5d 100644 (file)
@@ -324,7 +324,7 @@ add_files_recursive (notmuch_database_t *notmuch,
 
        /* Check if we've walked past any names in db_files or
         * db_subdirs. If so, these have been deleted. */
-       while (notmuch_filenames_has_more (db_files) &&
+       while (notmuch_filenames_valid (db_files) &&
               strcmp (notmuch_filenames_get (db_files), entry->d_name) < 0)
        {
            char *absolute = talloc_asprintf (state->removed_files,
@@ -333,10 +333,10 @@ add_files_recursive (notmuch_database_t *notmuch,
 
            _filename_list_add (state->removed_files, absolute);
 
-           notmuch_filenames_advance (db_files);
+           notmuch_filenames_move_to_next (db_files);
        }
 
-       while (notmuch_filenames_has_more (db_subdirs) &&
+       while (notmuch_filenames_valid (db_subdirs) &&
               strcmp (notmuch_filenames_get (db_subdirs), entry->d_name) <= 0)
        {
            const char *filename = notmuch_filenames_get (db_subdirs);
@@ -349,7 +349,7 @@ add_files_recursive (notmuch_database_t *notmuch,
                _filename_list_add (state->removed_directories, absolute);
            }
 
-           notmuch_filenames_advance (db_subdirs);
+           notmuch_filenames_move_to_next (db_subdirs);
        }
 
        /* If we're looking at a symlink, we only want to add it if it
@@ -381,10 +381,10 @@ add_files_recursive (notmuch_database_t *notmuch,
        }
 
        /* Don't add a file that we've added before. */
-       if (notmuch_filenames_has_more (db_files) &&
+       if (notmuch_filenames_valid (db_files) &&
            strcmp (notmuch_filenames_get (db_files), entry->d_name) == 0)
        {
-           notmuch_filenames_advance (db_files);
+           notmuch_filenames_move_to_next (db_files);
            continue;
        }
 
@@ -456,7 +456,7 @@ add_files_recursive (notmuch_database_t *notmuch,
 
     /* Now that we've walked the whole filesystem list, anything left
      * over in the database lists has been deleted. */
-    while (notmuch_filenames_has_more (db_files))
+    while (notmuch_filenames_valid (db_files))
     {
        char *absolute = talloc_asprintf (state->removed_files,
                                          "%s/%s", path,
@@ -464,10 +464,10 @@ add_files_recursive (notmuch_database_t *notmuch,
 
        _filename_list_add (state->removed_files, absolute);
 
-       notmuch_filenames_advance (db_files);
+       notmuch_filenames_move_to_next (db_files);
     }
 
-    while (notmuch_filenames_has_more (db_subdirs))
+    while (notmuch_filenames_valid (db_subdirs))
     {
        char *absolute = talloc_asprintf (state->removed_directories,
                                          "%s/%s", path,
@@ -475,7 +475,7 @@ add_files_recursive (notmuch_database_t *notmuch,
 
        _filename_list_add (state->removed_directories, absolute);
 
-       notmuch_filenames_advance (db_subdirs);
+       notmuch_filenames_move_to_next (db_subdirs);
     }
 
     if (! interrupted) {
@@ -676,8 +676,8 @@ _remove_directory (void *ctx,
     directory = notmuch_database_get_directory (notmuch, path);
 
     for (files = notmuch_directory_get_child_files (directory);
-        notmuch_filenames_has_more (files);
-        notmuch_filenames_advance (files))
+        notmuch_filenames_valid (files);
+        notmuch_filenames_move_to_next (files))
     {
        absolute = talloc_asprintf (ctx, "%s/%s", path,
                                    notmuch_filenames_get (files));
@@ -690,8 +690,8 @@ _remove_directory (void *ctx,
     }
 
     for (subdirs = notmuch_directory_get_child_directories (directory);
-        notmuch_filenames_has_more (subdirs);
-        notmuch_filenames_advance (subdirs))
+        notmuch_filenames_valid (subdirs);
+        notmuch_filenames_move_to_next (subdirs))
     {
        absolute = talloc_asprintf (ctx, "%s/%s", path,
                                    notmuch_filenames_get (subdirs));
index 98f6442fb14f2ffc61a7650b1db9ab3afdc2f475..6c15536cff153d3d00ebe4d8a300c6361a9ea536 100644 (file)
@@ -293,8 +293,8 @@ notmuch_reply_format_default(void *ctx, notmuch_config_t *config, notmuch_query_
     char *reply_headers;
 
     for (messages = notmuch_query_search_messages (query);
-        notmuch_messages_has_more (messages);
-        notmuch_messages_advance (messages))
+        notmuch_messages_valid (messages);
+        notmuch_messages_move_to_next (messages))
     {
        message = notmuch_messages_get (messages);
 
@@ -368,8 +368,8 @@ notmuch_reply_format_headers_only(void *ctx, notmuch_config_t *config, notmuch_q
     char *reply_headers;
 
     for (messages = notmuch_query_search_messages (query);
-        notmuch_messages_has_more (messages);
-        notmuch_messages_advance (messages))
+        notmuch_messages_valid (messages);
+        notmuch_messages_move_to_next (messages))
     {
        message = notmuch_messages_get (messages);
 
index 53ce2548dc71ddf9755f497aa9a184542ade66ec..b0a4e1ce7905fc52157ce35c471fe1b31446f549 100644 (file)
@@ -93,8 +93,8 @@ notmuch_restore_command (unused (void *ctx), int argc, char *argv[])
 
        db_tags_str = NULL;
        for (db_tags = notmuch_message_get_tags (message);
-            notmuch_tags_has_more (db_tags);
-            notmuch_tags_advance (db_tags))
+            notmuch_tags_valid (db_tags);
+            notmuch_tags_move_to_next (db_tags))
        {
            const char *tag = notmuch_tags_get (db_tags);
 
index 7a1305e2fed98368ae42995a1bf3f28fcaae997e..6f3cfccbbf1bd2c80a113a69a3e2f4ce16881058 100644 (file)
@@ -28,7 +28,7 @@ print_tags (notmuch_tags_t *tags)
 
     while ((t = notmuch_tags_get (tags))) {
        printf ("%s\n", t);
-       notmuch_tags_advance (tags);
+       notmuch_tags_move_to_next (tags);
     }
 }
 
index 25dd6eba370b4b302135dc518ca7b4db1e285484..4e3514b686467ef3d719ad8a79fc546ed3acd90b 100644 (file)
@@ -146,8 +146,8 @@ do_search_threads (const void *ctx,
     fputs (format->results_start, stdout);
 
     for (threads = notmuch_query_search_threads (query);
-        notmuch_threads_has_more (threads);
-        notmuch_threads_advance (threads))
+        notmuch_threads_valid (threads);
+        notmuch_threads_move_to_next (threads))
     {
        int first_tag = 1;
 
@@ -174,8 +174,8 @@ do_search_threads (const void *ctx,
        fputs (format->tag_start, stdout);
 
        for (tags = notmuch_thread_get_tags (thread);
-            notmuch_tags_has_more (tags);
-            notmuch_tags_advance (tags))
+            notmuch_tags_valid (tags);
+            notmuch_tags_move_to_next (tags))
        {
            if (! first_tag)
                fputs (format->tag_sep, stdout);
index 1a1d6019eac95713f92976f2cefafd474256866a..36bb0d3085781a0ad0d4d7c529deb89489442ded 100644 (file)
@@ -90,8 +90,8 @@ _get_tags_as_string (const void *ctx, notmuch_message_t *message)
        return NULL;
 
     for (tags = notmuch_message_get_tags (message);
-        notmuch_tags_has_more (tags);
-        notmuch_tags_advance (tags))
+        notmuch_tags_valid (tags);
+        notmuch_tags_move_to_next (tags))
     {
        tag = notmuch_tags_get (tags);
 
@@ -355,8 +355,8 @@ show_messages (void *ctx, const show_format_t *format, notmuch_messages_t *messa
     fputs (format->message_set_start, stdout);
 
     for (;
-        notmuch_messages_has_more (messages);
-        notmuch_messages_advance (messages))
+        notmuch_messages_valid (messages);
+        notmuch_messages_move_to_next (messages))
     {
        if (!first_set)
            fputs (format->message_set_sep, stdout);
@@ -460,8 +460,8 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))
     fputs (format->message_set_start, stdout);
 
     for (threads = notmuch_query_search_threads (query);
-        notmuch_threads_has_more (threads);
-        notmuch_threads_advance (threads))
+        notmuch_threads_valid (threads);
+        notmuch_threads_move_to_next (threads))
     {
        thread = notmuch_threads_get (threads);
 
index 00588a11608bc0b5a8ead8d7f7e4a2bb804d403b..8b6f7dc081f4dcd79cba27539ccc0dca9fdfc246 100644 (file)
@@ -108,8 +108,8 @@ notmuch_tag_command (void *ctx, unused (int argc), unused (char *argv[]))
     }
 
     for (messages = notmuch_query_search_messages (query);
-        notmuch_messages_has_more (messages) && !interrupted;
-        notmuch_messages_advance (messages))
+        notmuch_messages_valid (messages) && !interrupted;
+        notmuch_messages_move_to_next (messages))
     {
        message = notmuch_messages_get (messages);