mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-21 18:38:08 +01:00
lib: Rename iterator functions to prepare for reverse iteration.
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'.
This commit is contained in:
parent
c5085642b8
commit
4e5d2f22db
17 changed files with 99 additions and 101 deletions
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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 */
|
||||
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
|
|
18
lib/query.cc
18
lib/query.cc
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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, " ");
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in a new issue