dovecot: Added unoptimized seq_range_array_add_range()

dovecot at dovecot.org dovecot at dovecot.org
Sun Jan 6 11:04:12 EET 2008


details:   http://hg.dovecot.org/dovecot/rev/010485455f75
changeset: 7127:010485455f75
user:      Timo Sirainen <tss at iki.fi>
date:      Sun Jan 06 11:00:44 2008 +0200
description:
Added unoptimized seq_range_array_add_range()

diffstat:

2 files changed, 10 insertions(+)
src/lib/seq-range-array.c |    8 ++++++++
src/lib/seq-range-array.h |    2 ++

diffs (30 lines):

diff -r 0861436bfe14 -r 010485455f75 src/lib/seq-range-array.c
--- a/src/lib/seq-range-array.c	Sun Jan 06 07:09:33 2008 +0200
+++ b/src/lib/seq-range-array.c	Sun Jan 06 11:00:44 2008 +0200
@@ -98,6 +98,14 @@ void seq_range_array_add(ARRAY_TYPE(seq_
 	} else {
 		array_insert(array, idx, &value, 1);
 	}
+}
+
+void seq_range_array_add_range(ARRAY_TYPE(seq_range) *array,
+			       uint32_t seq1, uint32_t seq2)
+{
+	/* FIXME: optimize */
+	for (; seq1 <= seq2; seq1++)
+		seq_range_array_add(array, 2, seq1);
 }
 
 bool seq_range_array_remove(ARRAY_TYPE(seq_range) *array, uint32_t seq)
diff -r 0861436bfe14 -r 010485455f75 src/lib/seq-range-array.h
--- a/src/lib/seq-range-array.h	Sun Jan 06 07:09:33 2008 +0200
+++ b/src/lib/seq-range-array.h	Sun Jan 06 11:00:44 2008 +0200
@@ -11,6 +11,8 @@ ARRAY_DEFINE_TYPE(seq_range, struct seq_
    initial size of init_count. */
 void seq_range_array_add(ARRAY_TYPE(seq_range) *array, unsigned int init_count,
 			 uint32_t seq);
+void seq_range_array_add_range(ARRAY_TYPE(seq_range) *array,
+			       uint32_t seq1, uint32_t seq2);
 /* 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 a sequence range. Returns number of sequences actually removed. */


More information about the dovecot-cvs mailing list