[dovecot-cvs] dovecot/src/lib-storage/index/dbox dbox-keywords.c, 1.6, 1.7 dbox-uidlist.c, 1.45, 1.46
tss at dovecot.org
tss at dovecot.org
Thu Mar 15 19:02:21 EET 2007
Update of /var/lib/cvs/dovecot/src/lib-storage/index/dbox
In directory talvi:/tmp/cvs-serv17750/lib-storage/index/dbox
Modified Files:
dbox-keywords.c dbox-uidlist.c
Log Message:
bsearch_insert_pos() API changed. Patch by Max Kellermann
Index: dbox-keywords.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/dbox/dbox-keywords.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- dbox-keywords.c 10 Sep 2006 12:48:26 -0000 1.6
+++ dbox-keywords.c 15 Mar 2007 17:02:16 -0000 1.7
@@ -23,9 +23,9 @@
int dbox_file_read_keywords(struct dbox_mailbox *mbox, struct dbox_file *file)
{
- struct keyword_map *map, *pos, kw;
+ struct keyword_map *map, kw;
const char *line;
- unsigned int idx, count;
+ unsigned int idx, count, insert_idx;
uoff_t last_offset;
if (array_is_created(&file->idx_file_keywords)) {
@@ -58,10 +58,14 @@
/* look up the position where to insert it */
map = array_get_modifiable(&file->idx_file_keywords, &count);
- pos = idx == 0 ? map :
+ if (idx == 0)
+ insert_idx = 0;
+ else {
bsearch_insert_pos(&kw, map, count, sizeof(*map),
- dbox_keyword_map_compare);
- array_insert(&file->idx_file_keywords, pos - map, &kw, 1);
+ dbox_keyword_map_compare,
+ &insert_idx);
+ }
+ array_insert(&file->idx_file_keywords, insert_idx, &kw, 1);
array_append(&file->file_idx_keywords, &kw.index_idx, 1);
if (++idx == file->keyword_count)
Index: dbox-uidlist.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/dbox/dbox-uidlist.c,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -d -r1.45 -r1.46
--- dbox-uidlist.c 22 Feb 2007 13:39:15 -0000 1.45
+++ dbox-uidlist.c 15 Mar 2007 17:02:16 -0000 1.46
@@ -152,7 +152,7 @@
static bool dbox_uidlist_add_entry(struct dbox_uidlist *uidlist,
const struct dbox_uidlist_entry *src_entry)
{
- struct dbox_uidlist_entry *dest_entry, **entries, **pos;
+ struct dbox_uidlist_entry *dest_entry, **entries;
const struct seq_range *range;
unsigned int i, idx, count;
@@ -163,10 +163,10 @@
/* append new file sequence */
idx = count;
} else {
- pos = bsearch_insert_pos(&src_entry->file_seq, entries, count,
- sizeof(*entries),
- dbox_uidlist_entry_cmp);
- idx = pos - entries;
+ bsearch_insert_pos(&src_entry->file_seq, entries, count,
+ sizeof(*entries),
+ dbox_uidlist_entry_cmp,
+ &idx);
}
if (idx == count || entries[idx]->file_seq != src_entry->file_seq) {
@@ -1318,7 +1318,7 @@
void dbox_uidlist_sync_append(struct dbox_uidlist_sync_ctx *ctx,
const struct dbox_uidlist_entry *entry)
{
- struct dbox_uidlist_entry *const *entries, **pos;
+ struct dbox_uidlist_entry *const *entries;
struct dbox_uidlist_entry *new_entry;
unsigned int count;
@@ -1344,10 +1344,10 @@
else {
unsigned int idx;
- pos = bsearch_insert_pos(&new_entry->file_seq, entries,
- count, sizeof(*entries),
- dbox_uidlist_entry_cmp);
- idx = pos - entries;
+ bsearch_insert_pos(&new_entry->file_seq, entries,
+ count, sizeof(*entries),
+ dbox_uidlist_entry_cmp,
+ &idx);
i_assert(idx < count || idx == 0 ||
new_entry->file_seq > entries[idx-1]->file_seq);
More information about the dovecot-cvs
mailing list