dovecot-2.2: lib-fts: fts_tokenizer_reset() didn't reset the ent...

dovecot at dovecot.org dovecot at dovecot.org
Wed Jun 3 19:42:13 UTC 2015


details:   http://hg.dovecot.org/dovecot-2.2/rev/576267a41570
changeset: 18825:576267a41570
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Jun 03 22:39:52 2015 +0300
description:
lib-fts: fts_tokenizer_reset() didn't reset the entire state.

diffstat:

 src/lib-fts/fts-tokenizer.c |  16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)

diffs (47 lines):

diff -r 2f5799572a2f -r 576267a41570 src/lib-fts/fts-tokenizer.c
--- a/src/lib-fts/fts-tokenizer.c	Wed Jun 03 22:30:05 2015 +0300
+++ b/src/lib-fts/fts-tokenizer.c	Wed Jun 03 22:39:52 2015 +0300
@@ -66,6 +66,14 @@
 	return tok->name;
 }
 
+static void fts_tokenizer_self_reset(struct fts_tokenizer *tok)
+{
+	tok->prev_data = NULL;
+	tok->prev_size = 0;
+	tok->prev_skip = 0;
+	tok->prev_reply_finished = TRUE;
+}
+
 int fts_tokenizer_create(const struct fts_tokenizer *tok_class,
 			 struct fts_tokenizer *parent,
 			 const char *const *settings,
@@ -85,7 +93,7 @@
 		return -1;
 	}
 	tok->refcount = 1;
-	tok->prev_reply_finished = TRUE;
+	fts_tokenizer_self_reset(tok);
 	if (parent != NULL) {
 		fts_tokenizer_ref(parent);
 		tok->parent = parent;
@@ -150,10 +158,7 @@
 		tok->prev_reply_finished = FALSE;
 	} else if (ret == 0) {
 		/* we need a new data block */
-		tok->prev_data = NULL;
-		tok->prev_size = 0;
-		tok->prev_skip = 0;
-		tok->prev_reply_finished = TRUE;
+		fts_tokenizer_self_reset(tok);
 	}
 	return ret;
 }
@@ -161,6 +166,7 @@
 void fts_tokenizer_reset(struct fts_tokenizer *tok)
 {
 	tok->v->reset(tok);
+	fts_tokenizer_self_reset(tok);
 }
 
 int fts_tokenizer_next(struct fts_tokenizer *tok,


More information about the dovecot-cvs mailing list