dovecot-2.2: lib-fts: Use UTF8_IS_START_SEQ()

dovecot at dovecot.org dovecot at dovecot.org
Tue Jun 2 22:07:23 UTC 2015


details:   http://hg.dovecot.org/dovecot-2.2/rev/ff79a2178fd4
changeset: 18817:ff79a2178fd4
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Jun 03 01:04:07 2015 +0300
description:
lib-fts: Use UTF8_IS_START_SEQ()

diffstat:

 src/lib-fts/fts-tokenizer-generic.c |  6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diffs (23 lines):

diff -r b95be677f483 -r ff79a2178fd4 src/lib-fts/fts-tokenizer-generic.c
--- a/src/lib-fts/fts-tokenizer-generic.c	Wed Jun 03 01:03:52 2015 +0300
+++ b/src/lib-fts/fts-tokenizer-generic.c	Wed Jun 03 01:04:07 2015 +0300
@@ -96,8 +96,7 @@
 	/* the token is truncated - make sure the last character
 	   exists entirely in the token */
 	for (pos = *len-1; pos > 0; pos--) {
-		if ((data[pos] & 0x80) == 0 ||
-		    ((data[pos] & (0x80|0x40)) == (0x80|0x40)))
+		if (UTF8_IS_START_SEQ(data[pos]))
 			break;
 	}
 	char_bytes = uni_utf8_char_bytes(data[pos]);
@@ -555,8 +554,7 @@
 	if (is_one_past_end(tok) &&
 	    tok->untruncated_length <= tok->max_length) {
 		/* delete the last character */
-		while ((data[len-1] & 0x80) != 0 &&
-		       ((data[len-1] & (0x80|0x40)) != (0x80|0x40)))
+		while (!UTF8_IS_START_SEQ(data[len-1]))
 			len--;
 		i_assert(len > 0);
 		len--;


More information about the dovecot-cvs mailing list