Mercurial > dovecot > original-hg > dovecot-1.2
changeset 7568:66e6b61680a5 HEAD
Sort index: Fix to renumbering sort IDs.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Thu, 29 May 2008 18:47:46 +0300 |
parents | 9c0d2413735d |
children | ea913434d522 |
files | src/lib-storage/index/index-sort-string.c |
diffstat | 1 files changed, 10 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-storage/index/index-sort-string.c Thu May 29 16:29:35 2008 +0300 +++ b/src/lib-storage/index/index-sort-string.c Thu May 29 18:47:46 2008 +0300 @@ -498,18 +498,22 @@ renumber some of the existing sort IDs. do this by widening the area we're giving sort IDs. */ if (left_idx > 0) { - left_idx--; - left_sort_id = left_idx == 0 ? 1 : - nodes[left_idx].sort_id; - i_assert(left_sort_id != 0); + left_sort_id = nodes[--left_idx].sort_id; + if (left_sort_id == 0) { + i_assert(left_idx == 0); + left_sort_id = 1; + } } while (right_idx < rightmost_idx) { if (nodes[++right_idx].sort_id > 1) break; } - right_sort_id = right_idx == rightmost_idx ? (uint32_t)-1 : - nodes[right_idx].sort_id; + right_sort_id = nodes[right_idx].sort_id; + if (right_sort_id == 0) { + i_assert(right_idx == rightmost_idx); + right_sort_id = (uint32_t)-1; + } i_assert(left_sort_id < right_sort_id); }