diff options
author | Philip Kelley <phkelley@hotmail.com> | 2013-01-27 23:17:07 +0400 |
---|---|---|
committer | Philip Kelley <phkelley@hotmail.com> | 2013-01-27 23:17:07 +0400 |
commit | 11d9f6b30438a141def883b0115f7f764c03e990 (patch) | |
tree | abe54e8085c4e3a1c7a822ee256f81e0d58e6b42 /src/util.c | |
parent | aa3bf89df21c44f22fe70b4aac9109646fd06b48 (diff) |
Vector improvements and their fallout
Diffstat (limited to 'src/util.c')
-rw-r--r-- | src/util.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/util.c b/src/util.c index 085b627ce..059108ece 100644 --- a/src/util.c +++ b/src/util.c @@ -501,11 +501,11 @@ int git__bsearch( int (*compare)(const void *, const void *), size_t *position) { - unsigned int lim; + size_t lim; int cmp = -1; void **part, **base = array; - for (lim = (unsigned int)array_len; lim != 0; lim >>= 1) { + for (lim = array_len; lim != 0; lim >>= 1) { part = base + (lim >> 1); cmp = (*compare)(key, *part); if (cmp == 0) { @@ -521,7 +521,7 @@ int git__bsearch( if (position) *position = (base - array); - return (cmp == 0) ? 0 : -1; + return (cmp == 0) ? 0 : GIT_ENOTFOUND; } int git__bsearch_r( @@ -532,11 +532,11 @@ int git__bsearch_r( void *payload, size_t *position) { - unsigned int lim; + size_t lim; int cmp = -1; void **part, **base = array; - for (lim = (unsigned int)array_len; lim != 0; lim >>= 1) { + for (lim = array_len; lim != 0; lim >>= 1) { part = base + (lim >> 1); cmp = (*compare_r)(key, *part, payload); if (cmp == 0) { @@ -552,7 +552,7 @@ int git__bsearch_r( if (position) *position = (base - array); - return (cmp == 0) ? 0 : -1; + return (cmp == 0) ? 0 : GIT_ENOTFOUND; } /** |