dovecot-2.2: seq_range_array_remove() now returns void. Added se...
dovecot at dovecot.org
dovecot at dovecot.org
Sun Jun 24 21:19:41 EEST 2012
details: http://hg.dovecot.org/dovecot-2.2/rev/737a49f472d1
changeset: 14677:737a49f472d1
user: Timo Sirainen <tss at iki.fi>
date: Sun Jun 24 21:19:33 2012 +0300
description:
seq_range_array_remove() now returns void. Added seq_ranger_array_try_remove().
diffstat:
src/lib-index/mail-index-transaction-update.c | 2 +-
src/lib-storage/index/index-sync.c | 2 +-
src/lib-storage/mailbox-search-result.c | 2 +-
src/lib/seq-range-array.c | 11 ++++++++---
src/lib/seq-range-array.h | 6 ++++--
src/lib/test-seq-range-array.c | 2 +-
6 files changed, 16 insertions(+), 9 deletions(-)
diffs (97 lines):
diff -r 69ba6977bed8 -r 737a49f472d1 src/lib-index/mail-index-transaction-update.c
--- a/src/lib-index/mail-index-transaction-update.c Sun Jun 24 21:14:56 2012 +0300
+++ b/src/lib-index/mail-index-transaction-update.c Sun Jun 24 21:19:33 2012 +0300
@@ -1149,7 +1149,7 @@
static bool mail_index_cancel_array(ARRAY_TYPE(seq_range) *array, uint32_t seq)
{
if (array_is_created(array)) {
- if (seq_range_array_remove(array, seq)) {
+ if (seq_range_array_try_remove(array, seq)) {
if (array_count(array) == 0)
array_free(array);
return TRUE;
diff -r 69ba6977bed8 -r 737a49f472d1 src/lib-storage/index/index-sync.c
--- a/src/lib-storage/index/index-sync.c Sun Jun 24 21:14:56 2012 +0300
+++ b/src/lib-storage/index/index-sync.c Sun Jun 24 21:19:33 2012 +0300
@@ -129,7 +129,7 @@
for (; seq1 <= seq2; seq1++) {
mail_index_lookup_uid(box->view, seq1, &uid);
- if (seq_range_array_remove(&ibox->recent_flags, uid))
+ if (seq_range_array_try_remove(&ibox->recent_flags, uid))
ibox->recent_flags_count--;
}
}
diff -r 69ba6977bed8 -r 737a49f472d1 src/lib-storage/mailbox-search-result.c
--- a/src/lib-storage/mailbox-search-result.c Sun Jun 24 21:14:56 2012 +0300
+++ b/src/lib-storage/mailbox-search-result.c Sun Jun 24 21:19:33 2012 +0300
@@ -131,7 +131,7 @@
void mailbox_search_result_remove(struct mail_search_result *result,
uint32_t uid)
{
- if (seq_range_array_remove(&result->uids, uid)) {
+ if (seq_range_array_try_remove(&result->uids, uid)) {
if (array_is_created(&result->removed_uids)) {
seq_range_array_add(&result->removed_uids, uid);
seq_range_array_remove(&result->added_uids, uid);
diff -r 69ba6977bed8 -r 737a49f472d1 src/lib/seq-range-array.c
--- a/src/lib/seq-range-array.c Sun Jun 24 21:14:56 2012 +0300
+++ b/src/lib/seq-range-array.c Sun Jun 24 21:19:33 2012 +0300
@@ -166,7 +166,12 @@
seq_range_array_add_range(dest, range->seq1, range->seq2);
}
-bool seq_range_array_remove(ARRAY_TYPE(seq_range) *array, uint32_t seq)
+void seq_range_array_remove(ARRAY_TYPE(seq_range) *array, uint32_t seq)
+{
+ (void)seq_range_array_remove(array, seq);
+}
+
+bool seq_range_array_try_remove(ARRAY_TYPE(seq_range) *array, uint32_t seq)
{
struct seq_range *data, value;
unsigned int idx, left_idx, right_idx, count;
@@ -249,13 +254,13 @@
FIXME: it would be faster if we did only one binary lookup here
and handled the splitting ourself.. */
- if (seq_range_array_remove(array, seq1))
+ if (seq_range_array_try_remove(array, seq1))
remove_count++;
if (seq1 == seq2)
return remove_count;
seq1++;
- if (seq_range_array_remove(array, seq2--))
+ if (seq_range_array_try_remove(array, seq2--))
remove_count++;
if (seq1 > seq2)
return remove_count;
diff -r 69ba6977bed8 -r 737a49f472d1 src/lib/seq-range-array.h
--- a/src/lib/seq-range-array.h Sun Jun 24 21:14:56 2012 +0300
+++ b/src/lib/seq-range-array.h Sun Jun 24 21:19:33 2012 +0300
@@ -25,8 +25,10 @@
uint32_t seq1, uint32_t seq2);
void seq_range_array_merge(ARRAY_TYPE(seq_range) *dest,
const ARRAY_TYPE(seq_range) *src);
-/* Remove given sequrence from range. Returns TRUE if it was found. */
-bool seq_range_array_remove(ARRAY_TYPE(seq_range) *array, uint32_t seq);
+/* Remove the given sequrence from range. */
+void seq_range_array_remove(ARRAY_TYPE(seq_range) *array, uint32_t seq);
+/* Remove the given sequrence from range. Returns TRUE if it was found. */
+bool seq_range_array_try_remove(ARRAY_TYPE(seq_range) *array, uint32_t seq);
/* Remove a sequence range. Returns number of sequences actually removed. */
unsigned int seq_range_array_remove_range(ARRAY_TYPE(seq_range) *array,
uint32_t seq1, uint32_t seq2);
diff -r 69ba6977bed8 -r 737a49f472d1 src/lib/test-seq-range-array.c
--- a/src/lib/test-seq-range-array.c Sun Jun 24 21:14:56 2012 +0300
+++ b/src/lib/test-seq-range-array.c Sun Jun 24 21:19:33 2012 +0300
@@ -47,7 +47,7 @@
memset(shadowbuf + seq1, 1, seq2 - seq1 + 1);
break;
case 2:
- ret = seq_range_array_remove(&range, seq1) ? 1 : 0;
+ ret = seq_range_array_try_remove(&range, seq1) ? 1 : 0;
ret2 = shadowbuf[seq1] != 0 ? 1 : 0;
shadowbuf[seq1] = 0;
break;
More information about the dovecot-cvs
mailing list