From 09a76e204cf339862f8b0b45979d65cc34aa3c36 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sun, 2 Jan 2005 09:46:59 +0000 Subject: r4477: expanded the test suite to increase code coverage a lot (This used to be commit 4edbd1b18ee38e584cf844b64c7fcb2645921837) --- source4/lib/ldb/common/util.c | 51 ------------------------------------------- 1 file changed, 51 deletions(-) (limited to 'source4/lib/ldb/common') diff --git a/source4/lib/ldb/common/util.c b/source4/lib/ldb/common/util.c index 0c9cf297c1..c2fd72acd1 100644 --- a/source4/lib/ldb/common/util.c +++ b/source4/lib/ldb/common/util.c @@ -37,57 +37,6 @@ #include "ldb/include/ldb_private.h" -/* - find an element in a list, using the given comparison function and - assuming that the list is already sorted using comp_fn - - return -1 if not found, or the index of the first occurance of needle if found -*/ -int ldb_list_find(const void *needle, - const void *base, size_t nmemb, size_t size, comparison_fn_t comp_fn) -{ - const char *base_p = base; - size_t min_i, max_i, test_i; - - if (nmemb == 0) { - return -1; - } - - min_i = 0; - max_i = nmemb-1; - - while (min_i < max_i) { - int r; - - test_i = (min_i + max_i) / 2; - r = comp_fn(needle, *(void * const *)(base_p + (size * test_i))); - if (r == 0) { - /* scan back for first element */ - while (test_i > 0 && - comp_fn(needle, *(void * const *)(base_p + (size * (test_i-1)))) == 0) { - test_i--; - } - return test_i; - } - if (r < 0) { - if (test_i == 0) { - return -1; - } - max_i = test_i - 1; - } - if (r > 0) { - min_i = test_i + 1; - } - } - - if (comp_fn(needle, *(void * const *)(base_p + (size * min_i))) == 0) { - return min_i; - } - - return -1; -} - - /* common code for parsing -o options in ldb tools */ -- cgit