summaryrefslogtreecommitdiff
path: root/bisect.c
diff options
context:
space:
mode:
authorChristian Couder <chriscool@tuxfamily.org>2009-04-04 22:59:36 +0200
committerJunio C Hamano <gitster@pobox.com>2009-04-05 01:29:44 -0700
commit4eb5b64631d281f3789b052efac53f4c1ec2c1b6 (patch)
tree3315b38b5dcaff863c4e97cb4220663e398ae1ec /bisect.c
parent951886481668b97485640a1b24fc73fccff0d629 (diff)
downloadgit-4eb5b64631d281f3789b052efac53f4c1ec2c1b6.tar.gz
bisect: use the new generic "sha1_pos" function to lookup sha1
instead of the specific one that was simpler but less efficient. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'bisect.c')
-rw-r--r--bisect.c23
1 files changed, 9 insertions, 14 deletions
diff --git a/bisect.c b/bisect.c
index 9178a7a8e2..47120c1cd8 100644
--- a/bisect.c
+++ b/bisect.c
@@ -2,6 +2,7 @@
#include "commit.h"
#include "diff.h"
#include "revision.h"
+#include "sha1-lookup.h"
#include "bisect.h"
static unsigned char (*skipped_sha1)[20];
@@ -399,22 +400,16 @@ static void prepare_skipped(void)
qsort(skipped_sha1, skipped_sha1_nr, sizeof(*skipped_sha1), skipcmp);
}
+static const unsigned char *skipped_sha1_access(size_t index, void *table)
+{
+ unsigned char (*skipped)[20] = table;
+ return skipped[index];
+}
+
static int lookup_skipped(unsigned char *sha1)
{
- int lo, hi;
- lo = 0;
- hi = skipped_sha1_nr;
- while (lo < hi) {
- int mi = (lo + hi) / 2;
- int cmp = hashcmp(sha1, skipped_sha1[mi]);
- if (!cmp)
- return mi;
- if (cmp < 0)
- hi = mi;
- else
- lo = mi + 1;
- }
- return -lo - 1;
+ return sha1_pos(sha1, skipped_sha1, skipped_sha1_nr,
+ skipped_sha1_access);
}
struct commit_list *filter_skipped(struct commit_list *list,