diff options
| author | Edward Thomson <ethomson@github.com> | 2016-02-25 15:11:14 -0500 |
|---|---|---|
| committer | Edward Thomson <ethomson@github.com> | 2016-03-23 17:08:37 -0400 |
| commit | 684b35c41b9166645e2edb9bc708aa7ddf9c1f24 (patch) | |
| tree | d36c6b41dcb8bdf086d097b41ff585d8202ac136 /src/iterator.h | |
| parent | ac05086c40266bdd4541c06d3be532ee118ed204 (diff) | |
| download | libgit2-684b35c41b9166645e2edb9bc708aa7ddf9c1f24.tar.gz | |
iterator: disambiguate reset and reset_range
Disambiguate the reset and reset_range functions. Now reset_range
with a NULL path will clear the start or end; reset will leave the
existing start and end unchanged.
Diffstat (limited to 'src/iterator.h')
| -rw-r--r-- | src/iterator.h | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/iterator.h b/src/iterator.h index 3f5c82870..019f2e621 100644 --- a/src/iterator.h +++ b/src/iterator.h @@ -57,7 +57,8 @@ typedef struct { int (*current)(const git_index_entry **, git_iterator *); int (*advance)(const git_index_entry **, git_iterator *); int (*advance_into)(const git_index_entry **, git_iterator *); - int (*reset)(git_iterator *, const char *start, const char *end); + int (*reset)(git_iterator *); + int (*reset_range)(git_iterator *, const char *start, const char *end); int (*at_end)(git_iterator *); void (*free)(git_iterator *); } git_iterator_callbacks; @@ -201,15 +202,20 @@ GIT_INLINE(int) git_iterator_advance_into_or_over( /** * Go back to the start of the iteration. - * - * This resets the iterator to the start of the iteration. It also allows - * you to reset the `start` and `end` pathname boundaries of the iteration - * when doing so. */ -GIT_INLINE(int) git_iterator_reset( +GIT_INLINE(int) git_iterator_reset(git_iterator *iter) +{ + return iter->cb->reset(iter); +} + +/** + * Go back to the start of the iteration after updating the `start` and + * `end` pathname boundaries of the iteration. + */ +GIT_INLINE(int) git_iterator_reset_range( git_iterator *iter, const char *start, const char *end) { - return iter->cb->reset(iter, start, end); + return iter->cb->reset_range(iter, start, end); } /** |
