Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2012-11-14 02:02:59 +0400
committerRussell Belfer <rb@github.com>2012-11-15 10:55:40 +0400
commitbad68c0a998116685ad75cab84210004dd2c5be1 (patch)
treed8b6db9be06ea1fcc150b5a7d2ba4cd635a174aa /src/vector.h
parent5735bf5e6ab4da347b601d4b85c09c5c701dc002 (diff)
Add iterator for git_index object
The index iterator could previously only be created from a repo object, but this allows creating an iterator from a `git_index` object instead (while keeping, though renaming, the old function).
Diffstat (limited to 'src/vector.h')
-rw-r--r--src/vector.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/vector.h b/src/vector.h
index 5061f7846..6d820b8fc 100644
--- a/src/vector.h
+++ b/src/vector.h
@@ -29,17 +29,26 @@ void git_vector_swap(git_vector *a, git_vector *b);
void git_vector_sort(git_vector *v);
+/** Linear search for matching entry using internal comparison function */
int git_vector_search(git_vector *v, const void *entry);
+
+/** Linear search for matching entry using explicit comparison function */
int git_vector_search2(git_vector *v, git_vector_cmp cmp, const void *key);
+/**
+ * Binary search for matching entry using explicit comparison function that
+ * returns position where item would go if not found.
+ */
int git_vector_bsearch3(
unsigned int *at_pos, git_vector *v, git_vector_cmp cmp, const void *key);
+/** Binary search for matching entry using internal comparison function */
GIT_INLINE(int) git_vector_bsearch(git_vector *v, const void *key)
{
return git_vector_bsearch3(NULL, v, v->_cmp, key);
}
+/** Binary search for matching entry using explicit comparison function */
GIT_INLINE(int) git_vector_bsearch2(
git_vector *v, git_vector_cmp cmp, const void *key)
{