summaryrefslogtreecommitdiff
path: root/src/iterator.h
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2013-01-08 13:39:15 -0800
committerRussell Belfer <rb@github.com>2013-01-15 09:49:32 -0800
commit4b181037553601a0747ad39ccdd85ebd3b184055 (patch)
tree1f4bb97ad79bd9f86337d372317e68f862fa1b3c /src/iterator.h
parentfacc0650b12655c9637732bb992d1053cd946057 (diff)
downloadlibgit2-4b181037553601a0747ad39ccdd85ebd3b184055.tar.gz
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.h')
-rw-r--r--src/iterator.h52
1 files changed, 12 insertions, 40 deletions
diff --git a/src/iterator.h b/src/iterator.h
index 8a4356e3e..727da97b3 100644
--- a/src/iterator.h
+++ b/src/iterator.h
@@ -44,47 +44,34 @@ struct git_iterator {
bool ignore_case;
};
-extern int git_iterator_for_nothing(git_iterator **iter);
+extern int git_iterator_for_nothing(git_iterator **out);
extern int git_iterator_for_tree_range(
- git_iterator **iter, git_tree *tree,
- const char *start, const char *end);
+ git_iterator **out, git_tree *tree, const char *start, const char *end);
-GIT_INLINE(int) git_iterator_for_tree(
- git_iterator **iter, git_tree *tree)
+GIT_INLINE(int) git_iterator_for_tree(git_iterator **out, git_tree *tree)
{
- return git_iterator_for_tree_range(iter, tree, NULL, NULL);
+ return git_iterator_for_tree_range(out, tree, NULL, NULL);
}
extern int git_iterator_for_index_range(
- git_iterator **iter, git_index *index, const char *start, const char *end);
+ git_iterator **out, git_index *index, const char *start, const char *end);
-GIT_INLINE(int) git_iterator_for_index(
- git_iterator **iter, git_index *index)
+GIT_INLINE(int) git_iterator_for_index(git_iterator **out, git_index *index)
{
- return git_iterator_for_index_range(iter, index, NULL, NULL);
-}
-
-extern int git_iterator_for_repo_index_range(
- git_iterator **iter, git_repository *repo,
- const char *start, const char *end);
-
-GIT_INLINE(int) git_iterator_for_repo_index(
- git_iterator **iter, git_repository *repo)
-{
- return git_iterator_for_repo_index_range(iter, repo, NULL, NULL);
+ return git_iterator_for_index_range(out, index, NULL, NULL);
}
extern int git_iterator_for_workdir_range(
- git_iterator **iter, git_repository *repo,
- const char *start, const char *end);
+ git_iterator **out, git_repository *repo, const char *start, const char *end);
-GIT_INLINE(int) git_iterator_for_workdir(
- git_iterator **iter, git_repository *repo)
+GIT_INLINE(int) git_iterator_for_workdir(git_iterator **out, git_repository *repo)
{
- return git_iterator_for_workdir_range(iter, repo, NULL, NULL);
+ return git_iterator_for_workdir_range(out, repo, NULL, NULL);
}
+extern void git_iterator_free(git_iterator *iter);
+
/* Spool all iterator values, resort with alternative ignore_case value
* and replace callbacks with spoolandsort alternates.
*/
@@ -130,21 +117,6 @@ GIT_INLINE(int) git_iterator_reset(
return iter->cb->reset(iter, start, end);
}
-GIT_INLINE(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_INLINE(git_iterator_type_t) git_iterator_type(git_iterator *iter)
{
return iter->type;