diff options
author | Edward Thomson <ethomson@github.com> | 2016-02-25 16:05:18 -0500 |
---|---|---|
committer | Edward Thomson <ethomson@github.com> | 2016-03-23 17:08:37 -0400 |
commit | be30387e8b95cbc626e2a4a4ebba9ac9678a1c06 (patch) | |
tree | 0ebbf7c85ec188a27a24d1bf60b1e17cb7520c19 /src/iterator.h | |
parent | 277c85eb1c54804ab503ade69be058a0afd426f4 (diff) | |
download | libgit2-be30387e8b95cbc626e2a4a4ebba9ac9678a1c06.tar.gz |
iterators: refactored tree iterator
Refactored the tree iterator to never recurse; simply process the
next entry in order in `advance`. Additionally, reduce the number of
allocations and sorting as much as possible to provide a ~30% speedup
on case-sensitive iteration. (The gains for case-insensitive iteration
are less majestic.)
Diffstat (limited to 'src/iterator.h')
-rw-r--r-- | src/iterator.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/iterator.h b/src/iterator.h index 019f2e621..8cd774b9d 100644 --- a/src/iterator.h +++ b/src/iterator.h @@ -69,6 +69,8 @@ struct git_iterator { git_repository *repo; char *start; char *end; + bool started; + bool ended; git_vector pathlist; size_t pathlist_walk_idx; int (*strcomp)(const char *a, const char *b); @@ -254,7 +256,7 @@ extern int git_iterator_current_tree_entry( const git_tree_entry **entry_out, git_iterator *iter); extern int git_iterator_current_parent_tree( - const git_tree **tree_out, git_iterator *iter, const char *parent_path); + const git_tree **tree_out, git_iterator *iter, size_t depth); extern bool git_iterator_current_is_ignored(git_iterator *iter); |