~ubuntu-branches/ubuntu/wily/dovecot/wily

« back to all changes in this revision

Viewing changes to src/lib-storage/index/index-sort-string.c

  • Committer: Package Import Robot
  • Author(s): Jaldhar H. Vyas
  • Date: 2013-09-09 00:57:32 UTC
  • mfrom: (1.13.11)
  • mto: (4.8.5 experimental) (1.16.1)
  • mto: This revision was merged to the branch mainline in revision 97.
  • Revision ID: package-import@ubuntu.com-20130909005732-dn1eell8srqbhh0e
Tags: upstream-2.2.5
ImportĀ upstreamĀ versionĀ 2.2.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Copyright (c) 2006-2012 Dovecot authors, see the included COPYING file */
 
1
/* Copyright (c) 2006-2013 Dovecot authors, see the included COPYING file */
2
2
 
3
3
/* The idea is that we use 32bit integers for string sort IDs which specifiy
4
4
   the sort order for primary sort condition. The whole 32bit integer space is
91
91
        i_array_init(&ctx->nonzero_nodes, 128);
92
92
}
93
93
 
94
 
static int sort_node_seq_cmp(const void *p1, const void *p2)
 
94
static int sort_node_seq_cmp(const struct mail_sort_node *n1,
 
95
                             const struct mail_sort_node *n2)
95
96
{
96
 
        const struct mail_sort_node *n1 = p1, *n2 = p2;
97
 
 
98
97
        if (n1->seq < n2->seq)
99
98
                return -1;
100
99
        if (n1->seq > n2->seq)
275
274
                i_assert(nodes[i].seq <= ctx->last_seq);
276
275
 
277
276
                T_BEGIN {
278
 
                        index_sort_header_get(mail, nodes[i].seq,
279
 
                                              sort_type, str);
 
277
                        (void)index_sort_header_get(mail, nodes[i].seq,
 
278
                                                    sort_type, str);
280
279
                        ctx->sort_strings[nodes[i].seq] =
281
280
                                str_len(str) == 0 ? "" :
282
281
                                p_strdup(pool, str_c(str));
383
382
        int ret;
384
383
 
385
384
        nodes = array_get_modifiable(&ctx->nonzero_nodes, &right_idx);
 
385
        i_assert(right_idx < INT_MAX);
386
386
        idx = left_idx = start_idx;
387
387
        while (left_idx < right_idx) {
388
388
                idx = (left_idx + right_idx) / 2;