diff options
author | Carlos Garnacho <carlos@lanedo.com> | 2011-07-21 17:28:55 +0200 |
---|---|---|
committer | Jürg Billeter <j@bitron.ch> | 2011-07-22 14:26:40 +0200 |
commit | 1f20819826ba64de7929cb353bea895bfa57eacb (patch) | |
tree | edb6fdd68fb0dd0b2109b4888e84e747dad05d1f | |
parent | 98b050ae30211cb485d99ee903f13ed1bf73bc53 (diff) | |
download | tracker-1f20819826ba64de7929cb353bea895bfa57eacb.tar.gz |
libtracker-miner: Fix nasty typo in TrackerPriorityQueue
binary search wasn't working quite ok, even though it wasn't really
noticeable in the most common case of having just 2 priorities in
the segments array.
-rw-r--r-- | src/libtracker-miner/tracker-priority-queue.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/libtracker-miner/tracker-priority-queue.c b/src/libtracker-miner/tracker-priority-queue.c index a882c0a81..d918f859c 100644 --- a/src/libtracker-miner/tracker-priority-queue.c +++ b/src/libtracker-miner/tracker-priority-queue.c @@ -84,16 +84,16 @@ priority_segment_alloc_node (TrackerPriorityQueue *queue, r = queue->segments->len - 1; while (queue->segments->len > 0 && !found) { - c = r + l / 2; + c = (r + l) / 2; segment = &g_array_index (queue->segments, PrioritySegment, c); if (segment->priority == priority) { found = TRUE; break; } else if (segment->priority > priority) { - l = c + 1; - } else if (segment->priority < priority) { r = c - 1; + } else if (segment->priority < priority) { + l = c + 1; } if (l > r) { |