diff options
author | Russell Belfer <rb@github.com> | 2013-01-09 01:39:15 +0400 |
---|---|---|
committer | Russell Belfer <rb@github.com> | 2013-01-15 21:49:32 +0400 |
commit | 4b181037553601a0747ad39ccdd85ebd3b184055 (patch) | |
tree | 1f4bb97ad79bd9f86337d372317e68f862fa1b3c /src/iterator.c | |
parent | facc0650b12655c9637732bb992d1053cd946057 (diff) |
Minor iterator API cleanups
In preparation for further iterator changes, this cleans up a few
small things in the iterator API:
* removed the git_iterator_for_repo_index_range API
* made git_iterator_free not be inlined
* minor param name and test function name tweaks
Diffstat (limited to 'src/iterator.c')
-rw-r--r-- | src/iterator.c | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/src/iterator.c b/src/iterator.c index 08e2e79e4..3d75dd8b5 100644 --- a/src/iterator.c +++ b/src/iterator.c @@ -485,20 +485,6 @@ int git_iterator_for_index_range( return 0; } -int git_iterator_for_repo_index_range( - git_iterator **iter, - git_repository *repo, - const char *start, - const char *end) -{ - int error; - git_index *index; - - if ((error = git_repository_index__weakptr(&index, repo)) < 0) - return error; - - return git_iterator_for_index_range(iter, index, start, end); -} typedef struct workdir_iterator_frame workdir_iterator_frame; struct workdir_iterator_frame { @@ -988,6 +974,22 @@ fail: return -1; } + +void git_iterator_free(git_iterator *iter) +{ + if (iter == NULL) + return; + + iter->cb->free(iter); + + git__free(iter->start); + git__free(iter->end); + + memset(iter, 0, sizeof(*iter)); + + git__free(iter); +} + git_index *git_iterator_index_get_index(git_iterator *iter) { if (iter->type == GIT_ITERATOR_INDEX) |