dovecot-2.2: seq_range_array_add() API changed. Added other func...

dovecot at dovecot.org dovecot at dovecot.org
Sun Jun 24 21:15:09 EEST 2012


details:   http://hg.dovecot.org/dovecot-2.2/rev/69ba6977bed8
changeset: 14676:69ba6977bed8
user:      Timo Sirainen <tss at iki.fi>
date:      Sun Jun 24 21:14:56 2012 +0300
description:
seq_range_array_add() API changed. Added other functions to provide the less common use cases.

diffstat:

 src/doveadm/dsync/dsync-mailbox-export.c                 |  14 +++++-----
 src/doveadm/dsync/dsync-mailbox-import.c                 |   5 +--
 src/imap/cmd-store.c                                     |   3 +-
 src/imap/imap-search.c                                   |   2 +-
 src/lib-index/mail-index-sync-update.c                   |   2 +-
 src/lib-index/mail-index-transaction-finish.c            |   4 +-
 src/lib-index/mail-index-transaction-sort-appends.c      |   2 +-
 src/lib-index/mail-index-transaction-update.c            |   8 ++++--
 src/lib-index/mail-index-view-sync.c                     |   8 +++---
 src/lib-storage/index/dbox-multi/mdbox-map.c             |   6 ++--
 src/lib-storage/index/dbox-multi/mdbox-purge.c           |   8 +++---
 src/lib-storage/index/dbox-multi/mdbox-storage-rebuild.c |   2 +-
 src/lib-storage/index/dbox-multi/mdbox-sync.c            |   2 +-
 src/lib-storage/index/imapc/imapc-save.c                 |   4 +-
 src/lib-storage/index/index-search.c                     |   6 ++--
 src/lib-storage/index/index-sync-search.c                |   2 +-
 src/lib-storage/index/index-sync.c                       |   2 +-
 src/lib-storage/mail-search.c                            |   2 +-
 src/lib-storage/mailbox-get.c                            |   4 +-
 src/lib-storage/mailbox-search-result.c                  |   8 +++---
 src/lib/seq-range-array.c                                |  19 +++++++++++----
 src/lib/seq-range-array.h                                |  12 +++++++--
 src/lib/test-seq-range-array.c                           |  12 +++++-----
 src/plugins/fts-lucene/lucene-wrapper.cc                 |   4 +-
 src/plugins/fts-solr/solr-connection.c                   |   2 +-
 src/plugins/fts-squat/squat-trie.c                       |   2 +-
 src/plugins/fts-squat/squat-uidlist.c                    |   2 +-
 src/plugins/fts/fts-api.c                                |   2 +-
 src/plugins/fts/fts-expunge-log.c                        |   2 +-
 src/plugins/fts/fts-search.c                             |   2 +-
 src/plugins/virtual/virtual-search.c                     |   4 +-
 src/plugins/virtual/virtual-storage.c                    |   2 +-
 src/plugins/virtual/virtual-sync.c                       |  16 ++++++------
 33 files changed, 95 insertions(+), 80 deletions(-)

diffs (truncated from 758 to 300 lines):

diff -r f07ba5e7d97d -r 69ba6977bed8 src/doveadm/dsync/dsync-mailbox-export.c
--- a/src/doveadm/dsync/dsync-mailbox-export.c	Sun Jun 24 20:58:04 2012 +0300
+++ b/src/doveadm/dsync/dsync-mailbox-export.c	Sun Jun 24 21:14:56 2012 +0300
@@ -212,7 +212,7 @@
 
 	if (exporter->auto_export_mails && !exporter->mails_have_guids) {
 		/* GUIDs not supported, mail is requested by UIDs */
-		seq_range_array_add(&exporter->requested_uids, 0, change->uid);
+		seq_range_array_add(&exporter->requested_uids, change->uid);
 		return;
 	}
 	if (*change->guid == '\0') {
@@ -232,7 +232,7 @@
 		if (exporter->auto_export_mails)
 			instances->requested = TRUE;
 	}
-	seq_range_array_add(&instances->seqs, 0, seq);
+	seq_range_array_add(&instances->seqs, seq);
 }
 
 static int
@@ -273,7 +273,7 @@
 		const struct dsync_mail_change *change = value;
 
 		if (change->type == DSYNC_MAIL_CHANGE_TYPE_FLAG_CHANGE)
-			seq_range_array_add(uids, 0, change->uid);
+			seq_range_array_add(uids, change->uid);
 	}
 	hash_table_iterate_deinit(&iter);
 }
@@ -494,7 +494,7 @@
 		seq = uids[0].seq1;
 		if (!instances->searched) {
 			instances->searched = TRUE;
-			seq_range_array_add(&sarg->value.seqset, 0, seq);
+			seq_range_array_add(&sarg->value.seqset, seq);
 		} else if (seq_range_exists(&exporter->expunged_seqs, seq)) {
 			/* we're on a second round, refetching expunged
 			   messages */
@@ -508,7 +508,7 @@
 			}
 			uids = array_idx(&instances->seqs, 0);
 			seq = uids[0].seq1;
-			seq_range_array_add(&sarg->value.seqset, 0, seq);
+			seq_range_array_add(&sarg->value.seqset, seq);
 		}
 	}
 	hash_table_iterate_deinit(&iter);
@@ -608,7 +608,7 @@
 
 	if (*request->guid == '\0') {
 		i_assert(request->uid > 0);
-		seq_range_array_add(&exporter->requested_uids, 0, request->uid);
+		seq_range_array_add(&exporter->requested_uids, request->uid);
 		return;
 	}
 
@@ -648,7 +648,7 @@
 		}
 		/* the message was expunged. if the GUID has another instance,
 		   try sending it later. */
-		seq_range_array_add(&exporter->expunged_seqs, 0, mail->seq);
+		seq_range_array_add(&exporter->expunged_seqs, mail->seq);
 	}
 	/* if some instances of messages were expunged, retry fetching them
 	   with other instances */
diff -r f07ba5e7d97d -r 69ba6977bed8 src/doveadm/dsync/dsync-mailbox-import.c
--- a/src/doveadm/dsync/dsync-mailbox-import.c	Sun Jun 24 20:58:04 2012 +0300
+++ b/src/doveadm/dsync/dsync-mailbox-import.c	Sun Jun 24 21:14:56 2012 +0300
@@ -199,7 +199,7 @@
 			/* this message exists locally, but remote didn't send
 			   expunge-change for it. if the message's
 			   uid <= last-common-uid, it should be deleted */
-			seq_range_array_add(&importer->maybe_expunge_uids, 0,
+			seq_range_array_add(&importer->maybe_expunge_uids, 
 					    importer->cur_mail->uid);
 		}
 
@@ -751,8 +751,7 @@
 		/* we don't know yet if we should expunge this
 		   message or not. queue it until we do. */
 		i_assert(change->uid > importer->last_common_uid);
-		seq_range_array_add(&importer->maybe_expunge_uids, 0,
-				    change->uid);
+		seq_range_array_add(&importer->maybe_expunge_uids, change->uid);
 	}
 }
 
diff -r f07ba5e7d97d -r 69ba6977bed8 src/imap/cmd-store.c
--- a/src/imap/cmd-store.c	Sun Jun 24 20:58:04 2012 +0300
+++ b/src/imap/cmd-store.c	Sun Jun 24 21:14:56 2012 +0300
@@ -189,8 +189,7 @@
 			/* check early so there's less work for transaction
 			   commit if something has to be cancelled */
 			if (mail_get_modseq(mail) > ctx.max_modseq) {
-				seq_range_array_add(&modified_set, 0,
-						    mail->seq);
+				seq_range_array_add(&modified_set, mail->seq);
 				continue;
 			}
 		}
diff -r f07ba5e7d97d -r 69ba6977bed8 src/imap/imap-search.c
--- a/src/imap/imap-search.c	Sun Jun 24 20:58:04 2012 +0300
+++ b/src/imap/imap-search.c	Sun Jun 24 21:14:56 2012 +0300
@@ -334,7 +334,7 @@
 	}
 	if ((ctx->return_options & SEARCH_RETURN_SAVE) != 0) {
 		seq_range_array_add(&ctx->cmd->client->search_saved_uidset,
-				    0, mail->uid);
+				    mail->uid);
 	}
 	if ((ctx->return_options & SEARCH_RETURN_RELEVANCY) != 0) {
 		const char *str;
diff -r f07ba5e7d97d -r 69ba6977bed8 src/lib-index/mail-index-sync-update.c
--- a/src/lib-index/mail-index-sync-update.c	Sun Jun 24 20:58:04 2012 +0300
+++ b/src/lib-index/mail-index-sync-update.c	Sun Jun 24 21:14:56 2012 +0300
@@ -545,7 +545,7 @@
 					rec->uid);
 				break;
 			}
-			seq_range_array_add(&uids, 0, rec->uid);
+			seq_range_array_add(&uids, rec->uid);
 		}
 
 		/* do this in reverse so the memmove()s are smaller */
diff -r f07ba5e7d97d -r 69ba6977bed8 src/lib-index/mail-index-transaction-finish.c
--- a/src/lib-index/mail-index-transaction-finish.c	Sun Jun 24 20:58:04 2012 +0300
+++ b/src/lib-index/mail-index-transaction-finish.c	Sun Jun 24 21:14:56 2012 +0300
@@ -129,7 +129,7 @@
 			if ((rec->flags & u->add_flags) != u->add_flags ||
 			    (rec->flags & u->remove_flags) != 0) {
 				/* keep this change */
-				seq_range_array_add(&keeps, 0, seq);
+				seq_range_array_add(&keeps, seq);
 			}
 		}
 		i = mail_transaction_drop_range(t, updates[i], i, &keeps);
@@ -163,7 +163,7 @@
 			ret1 = mail_index_cancel_flag_updates(t, seq);
 			ret2 = mail_index_cancel_keyword_updates(t, seq);
 			if (ret1 || ret2)
-				seq_range_array_add(t->conflict_seqs, 0, seq);
+				seq_range_array_add(t->conflict_seqs, seq);
 		}
 	}
 	mail_index_transaction_set_log_updates(t);
diff -r f07ba5e7d97d -r 69ba6977bed8 src/lib-index/mail-index-transaction-sort-appends.c
--- a/src/lib-index/mail-index-transaction-sort-appends.c	Sun Jun 24 20:58:04 2012 +0300
+++ b/src/lib-index/mail-index-transaction-sort-appends.c	Sun Jun 24 21:14:56 2012 +0300
@@ -95,7 +95,7 @@
 		idx1 = range[i].seq1 - first_new_seq;
 		idx2 = range[i].seq2 - first_new_seq;
 		for (idx = idx1; idx <= idx2; idx++)
-			seq_range_array_add(array, 0, old_to_newseq_map[idx]);
+			seq_range_array_add(array, old_to_newseq_map[idx]);
 	}
 	array_free(&old_seqs);
 }
diff -r f07ba5e7d97d -r 69ba6977bed8 src/lib-index/mail-index-transaction-update.c
--- a/src/lib-index/mail-index-transaction-update.c	Sun Jun 24 20:58:04 2012 +0300
+++ b/src/lib-index/mail-index-transaction-update.c	Sun Jun 24 21:14:56 2012 +0300
@@ -1089,15 +1089,17 @@
 			seq_range_array_remove(&u->add_seq, seq);
 			/* Don't bother updating remove_seq for new messages,
 			   since their initial state is "no keyword" anyway */
-			if (seq < t->first_new_seq)
-				seq_range_array_add(&u->remove_seq, 16, seq);
+			if (seq < t->first_new_seq) {
+				seq_range_array_add_with_init(&u->remove_seq,
+							      16, seq);
+			}
 		}
 	}
 	if (add_keywords != NULL) {
 		for (i = 0; i < add_keywords->count; i++) {
 			u = array_idx_modifiable(&t->keyword_updates,
 						 add_keywords->idx[i]);
-			seq_range_array_add(&u->add_seq, 16, seq);
+			seq_range_array_add_with_init(&u->add_seq, 16, seq);
 			seq_range_array_remove(&u->remove_seq, seq);
 		}
 	}
diff -r f07ba5e7d97d -r 69ba6977bed8 src/lib-index/mail-index-view-sync.c
--- a/src/lib-index/mail-index-view-sync.c	Sun Jun 24 20:58:04 2012 +0300
+++ b/src/lib-index/mail-index-view-sync.c	Sun Jun 24 21:14:56 2012 +0300
@@ -145,7 +145,7 @@
 
 	src_count = src_size / sizeof(*src);
 	for (i = 0; i < src_count; i++)
-		seq_range_array_add(dest, 0, src[i].uid);
+		seq_range_array_add(dest, src[i].uid);
 }
 
 static int
@@ -394,7 +394,7 @@
 	   be avoided by always keeping a private copy of the map in the view,
 	   but that's a waste of memory for as rare of a problem as this. */
 	if (changed)
-		seq_range_array_add(&ctx->lost_flags, 0, new_rec->uid);
+		seq_range_array_add(&ctx->lost_flags, new_rec->uid);
 	return 0;
 }
 
@@ -437,7 +437,7 @@
 			i++; j++;
 		} else if (old_rec->uid < new_rec->uid) {
 			/* message expunged */
-			seq_range_array_add(&ctx->expunges, 0, old_rec->uid);
+			seq_range_array_add(&ctx->expunges, old_rec->uid);
 			i++;
 		} else {
 			/* new message appeared out of nowhere */
@@ -451,7 +451,7 @@
 	/* if there are old messages left, they're all expunged */
 	for (; i < old_count; i++) {
 		old_rec = MAIL_INDEX_MAP_IDX(old_map, i);
-		seq_range_array_add(&ctx->expunges, 0, old_rec->uid);
+		seq_range_array_add(&ctx->expunges, old_rec->uid);
 	}
 	/* if there are new messages left, they're all new messages */
 	thdr.type = MAIL_TRANSACTION_APPEND | MAIL_TRANSACTION_EXTERNAL;
diff -r f07ba5e7d97d -r 69ba6977bed8 src/lib-storage/index/dbox-multi/mdbox-map.c
--- a/src/lib-storage/index/dbox-multi/mdbox-map.c	Sun Jun 24 20:58:04 2012 +0300
+++ b/src/lib-storage/index/dbox-multi/mdbox-map.c	Sun Jun 24 21:14:56 2012 +0300
@@ -444,7 +444,7 @@
 				      &data, &expunged);
 		if (data != NULL && !expunged) {
 			rec = data;
-			seq_range_array_add(file_ids_r, 0, rec->file_id);
+			seq_range_array_add(file_ids_r, rec->file_id);
 		}
 	}
 	return 0;
@@ -971,7 +971,7 @@
 				  &file_id) < 0)
 			continue;
 
-		seq_range_array_add(file_ids_r, 0, file_id);
+		seq_range_array_add(file_ids_r, file_id);
 	}
 	if (errno != 0) {
 		mail_storage_set_critical(storage,
@@ -1023,7 +1023,7 @@
 
 		if (seq_range_exists(&checked_file_ids, rec->file_id))
 			continue;
-		seq_range_array_add(&checked_file_ids, 0, rec->file_id);
+		seq_range_array_add(&checked_file_ids, rec->file_id);
 
 		if (++backwards_lookup_count > MAX_BACKWARDS_LOOKUPS) {
 			/* we've wasted enough time here */
diff -r f07ba5e7d97d -r 69ba6977bed8 src/lib-storage/index/dbox-multi/mdbox-purge.c
--- a/src/lib-storage/index/dbox-multi/mdbox-purge.c	Sun Jun 24 20:58:04 2012 +0300
+++ b/src/lib-storage/index/dbox-multi/mdbox-purge.c	Sun Jun 24 21:14:56 2012 +0300
@@ -369,7 +369,7 @@
 							 &ext_refs);
 			if (ret <= 0)
 				break;
-			seq_range_array_add(&expunged_map_uids, 0,
+			seq_range_array_add(&expunged_map_uids,
 					    msgs[i].map_uid);
 		} else {
 			/* non-expunged message. write it to output file. */
@@ -534,7 +534,7 @@
 
 		str_truncate(path, dir_len);
 		str_append(path, d->d_name);
-		seq_range_array_add(&ctx->primary_file_ids, 0, file_id);
+		seq_range_array_add(&ctx->primary_file_ids, file_id);
 	}
 	if (array_count(&ctx->primary_file_ids) > 0) {
 		const struct seq_range *range =
@@ -602,7 +602,7 @@
 			hash_table_insert(ctx->altmoves,
 				POINTER_CAST(cur_map_uid),
 				POINTER_CAST(MDBOX_MSG_ACTION_MOVE_TO_ALT));
-			seq_range_array_add(&ctx->purge_file_ids, 0,
+			seq_range_array_add(&ctx->purge_file_ids,
 					    cur_rec.file_id);
 		}
 	}
@@ -634,7 +634,7 @@
 
 		hash_table_insert(ctx->altmoves, POINTER_CAST(cur_map_uid),
 				  POINTER_CAST(MDBOX_MSG_ACTION_MOVE_FROM_ALT));
-		seq_range_array_add(&ctx->purge_file_ids, 0, cur_rec.file_id);
+		seq_range_array_add(&ctx->purge_file_ids, cur_rec.file_id);
 	}
 	ctx->have_altmoves = hash_table_count(ctx->altmoves) > 0;
 	return ret;
diff -r f07ba5e7d97d -r 69ba6977bed8 src/lib-storage/index/dbox-multi/mdbox-storage-rebuild.c
--- a/src/lib-storage/index/dbox-multi/mdbox-storage-rebuild.c	Sun Jun 24 20:58:04 2012 +0300
+++ b/src/lib-storage/index/dbox-multi/mdbox-storage-rebuild.c	Sun Jun 24 21:14:56 2012 +0300
@@ -262,7 +262,7 @@
 		if (rebuild_rename_file(ctx, dir, &fname, &file_id) < 0)
 			return -1;
 	}
-	seq_range_array_add(&ctx->seen_file_ids, 0, file_id);
+	seq_range_array_add(&ctx->seen_file_ids, file_id);
 


More information about the dovecot-cvs mailing list