dovecot: squat_trie_lookup() for empty string returns now all UI...

dovecot at dovecot.org dovecot at dovecot.org
Fri Feb 15 14:03:53 EET 2008


details:   http://hg.dovecot.org/dovecot/rev/68a59be6fb29
changeset: 7245:68a59be6fb29
user:      Timo Sirainen <tss at iki.fi>
date:      Fri Feb 15 14:04:10 2008 +0200
description:
squat_trie_lookup() for empty string returns now all UIDs from root node.
This is mainly useful for debugging.

diffstat:

1 file changed, 14 insertions(+), 1 deletion(-)
src/plugins/fts-squat/squat-trie.c |   15 ++++++++++++++-

diffs (32 lines):

diff -r 7e93b52dbada -r 68a59be6fb29 src/plugins/fts-squat/squat-trie.c
--- a/src/plugins/fts-squat/squat-trie.c	Fri Feb 15 13:25:46 2008 +0200
+++ b/src/plugins/fts-squat/squat-trie.c	Fri Feb 15 14:04:10 2008 +0200
@@ -1860,6 +1860,20 @@ squat_trie_lookup_real(struct squat_trie
 	array_clear(definite_uids);
 	array_clear(maybe_uids);
 
+	str_bytelen = strlen(str);
+	if (str_bytelen == 0) {
+		/* list all root UIDs */
+		i_array_init(&ctx.tmp_uids, 128);
+		ret = squat_uidlist_get_seqrange(trie->uidlist,
+						 trie->root.uid_list_idx,
+						 &ctx.tmp_uids);
+		squat_trie_filter_type(type, &ctx.tmp_uids,
+				       definite_uids);
+		squat_trie_add_unknown(trie, maybe_uids);
+		array_free(&ctx.tmp_uids);
+		return ret;
+	}
+
 	memset(&ctx, 0, sizeof(ctx));
 	ctx.trie = trie;
 	ctx.type = type;
@@ -1869,7 +1883,6 @@ squat_trie_lookup_real(struct squat_trie
 	i_array_init(&ctx.tmp_uids2, 128);
 	ctx.first = TRUE;
 
-	str_bytelen = strlen(str);
 	char_lengths = t_malloc0(str_bytelen);
 	for (i = 0, str_charlen = 0; i < str_bytelen; str_charlen++) {
 		bytes = uni_utf8_char_bytes(str[i]);


More information about the dovecot-cvs mailing list