aboutsummaryrefslogtreecommitdiffhomepage
path: root/notmuch-new.c
diff options
context:
space:
mode:
authorGravatar Carl Worth <cworth@cworth.org>2010-03-09 09:22:29 -0800
committerGravatar Carl Worth <cworth@cworth.org>2010-03-09 09:22:29 -0800
commit4e5d2f22db290a830c0267f34b519c6138af00ed (patch)
treeb75346865280153187774efb4cf38562fe912bfc /notmuch-new.c
parentc5085642b8c6495ffea3d5709aa6da14cd1d8688 (diff)
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'.
Diffstat (limited to 'notmuch-new.c')
-rw-r--r--notmuch-new.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/notmuch-new.c b/notmuch-new.c
index f25c71f3..44b50aaa 100644
--- a/notmuch-new.c
+++ b/notmuch-new.c
@@ -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));