#include "git-compat-util.h" #include "dir.h" #include "iterator.h" #include "dir-iterator.h" #include "string-list.h" struct dir_iterator_level { … }; /* * The full data structure used to manage the internal directory * iteration state. It includes members that are not part of the * public interface. */ struct dir_iterator_int { … }; static int next_directory_entry(DIR *dir, const char *path, struct dirent **out) { … } /* * Push a level in the iter stack and initialize it with information from * the directory pointed by iter->base->path. It is assumed that this * strbuf points to a valid directory path. Return 0 on success and -1 * otherwise, setting errno accordingly and leaving the stack unchanged. */ static int push_level(struct dir_iterator_int *iter) { … } /* * Pop the top level on the iter stack, releasing any resources associated * with it. Return the new value of iter->levels_nr. */ static int pop_level(struct dir_iterator_int *iter) { … } /* * Populate iter->base with the necessary information on the next iteration * entry, represented by the given name. Return 0 on success and -1 * otherwise, setting errno accordingly. */ static int prepare_next_entry_data(struct dir_iterator_int *iter, const char *name) { … } int dir_iterator_advance(struct dir_iterator *dir_iterator) { … } int dir_iterator_abort(struct dir_iterator *dir_iterator) { … } struct dir_iterator *dir_iterator_begin(const char *path, unsigned int flags) { … }