summaryrefslogtreecommitdiff
path: root/src/vector.h
diff options
context:
space:
mode:
authorPhilip Kelley <phkelley@hotmail.com>2013-01-27 14:17:07 -0500
committerPhilip Kelley <phkelley@hotmail.com>2013-01-27 14:17:07 -0500
commit11d9f6b30438a141def883b0115f7f764c03e990 (patch)
treeabe54e8085c4e3a1c7a822ee256f81e0d58e6b42 /src/vector.h
parentaa3bf89df21c44f22fe70b4aac9109646fd06b48 (diff)
downloadlibgit2-11d9f6b30438a141def883b0115f7f764c03e990.tar.gz
Vector improvements and their fallout
Diffstat (limited to 'src/vector.h')
-rw-r--r--src/vector.h17
1 files changed, 5 insertions, 12 deletions
diff --git a/src/vector.h b/src/vector.h
index 023f4b663..690e4af9c 100644
--- a/src/vector.h
+++ b/src/vector.h
@@ -30,29 +30,22 @@ 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(const git_vector *v, const void *entry);
+int git_vector_search(size_t *at_pos, const git_vector *v, const void *entry);
/** Linear search for matching entry using explicit comparison function */
-int git_vector_search2(const git_vector *v, git_vector_cmp cmp, const void *key);
+int git_vector_search2(size_t *at_pos, const 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(
+int git_vector_bsearch2(
size_t *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)
+GIT_INLINE(int) git_vector_bsearch(size_t *at_pos, 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)
-{
- return git_vector_bsearch3(NULL, v, cmp, key);
+ return git_vector_bsearch2(at_pos, v, v->_cmp, key);
}
GIT_INLINE(void *) git_vector_get(const git_vector *v, size_t position)