dovecot-2.2: lib-fts: Use fts_icu_lcase() for fts-filter-lowerca...

dovecot at dovecot.org dovecot at dovecot.org
Tue Jun 2 19:03:31 UTC 2015


details:   http://hg.dovecot.org/dovecot-2.2/rev/f227c2318e02
changeset: 18803:f227c2318e02
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Jun 02 21:56:29 2015 +0300
description:
lib-fts: Use fts_icu_lcase() for fts-filter-lowercase if possible.

diffstat:

 src/lib-fts/fts-filter-lowercase.c |  13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diffs (45 lines):

diff -r 26d9a4fcb0d4 -r f227c2318e02 src/lib-fts/fts-filter-lowercase.c
--- a/src/lib-fts/fts-filter-lowercase.c	Tue Jun 02 21:56:03 2015 +0300
+++ b/src/lib-fts/fts-filter-lowercase.c	Tue Jun 02 21:56:29 2015 +0300
@@ -2,12 +2,14 @@
 
 #include "lib.h"
 #include "str.h"
+#include "fts-icu.h"
+#include "fts-language.h"
 #include "fts-filter-private.h"
-#include "fts-language.h"
 
 static void
 fts_filter_lowercase_destroy(struct fts_filter *filter)
 {
+	str_free(&filter->token);
 	i_free(filter);
 }
 
@@ -25,17 +27,24 @@
 	}
 	filter = i_new(struct fts_filter, 1);
 	*filter = *fts_filter_lowercase;
+	filter->token = str_new(default_pool, 64);
 
 	*filter_r = filter;
 	return 0;
 }
 
 static int
-fts_filter_lowercase_filter(struct fts_filter *_filter ATTR_UNUSED,
+fts_filter_lowercase_filter(struct fts_filter *filter,
 			    const char **token,
 			    const char **error_r ATTR_UNUSED)
 {
+#ifdef HAVE_LIBICU
+	str_truncate(filter->token, 0);
+	fts_icu_lcase(filter->token, *token);
+	*token = str_c(filter->token);
+#else
 	*token = t_str_lcase(*token);
+#endif
 	return 1;
 }
 


More information about the dovecot-cvs mailing list