summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-09-19 16:45:45 +0000
committerDavid Robillard <d@drobilla.net>2011-09-19 16:45:45 +0000
commitc7b6685f1e383d043bd44964d176bf71fe9bbb73 (patch)
tree6e7a0c345853c4aaba8445fb5c7bc54fb168bd73 /src
parentf3f2fb716a132559b3adae3d8e9f2e122172f9e1 (diff)
downloadzix-c7b6685f1e383d043bd44964d176bf71fe9bbb73.tar.gz
zix-c7b6685f1e383d043bd44964d176bf71fe9bbb73.tar.bz2
zix-c7b6685f1e383d043bd44964d176bf71fe9bbb73.zip
Remove unnecessary check.
Use consistent types for index. git-svn-id: http://svn.drobilla.net/zix/trunk@27 df6676b4-ccc9-40e5-b5d6-7c4628a128e3
Diffstat (limited to 'src')
-rw-r--r--src/sorted_array.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/src/sorted_array.c b/src/sorted_array.c
index 7d5358b..ae08946 100644
--- a/src/sorted_array.c
+++ b/src/sorted_array.c
@@ -147,17 +147,12 @@ zix_sorted_array_find(const ZixSortedArray* a,
const void* e,
ZixSortedArrayIter* ai)
{
- if (a->num_elems == 0) {
- *ai = NULL;
- return ZIX_STATUS_NOT_FOUND;
- }
-
intptr_t lower = 0;
intptr_t upper = a->num_elems - 1;
while (upper >= lower) {
- const size_t i = lower + ((upper - lower) / 2);
- void* elem_i = zix_sorted_array_index_unchecked(a, i);
- const int cmp = a->cmp(elem_i, e, a->cmp_data);
+ const intptr_t i = lower + ((upper - lower) / 2);
+ void* const elem_i = zix_sorted_array_index_unchecked(a, i);
+ const int cmp = a->cmp(elem_i, e, a->cmp_data);
if (cmp == 0) {
*ai = elem_i;