dovecot-2.2: fts: Added unload() method to fts-parsers to allow ...

dovecot at dovecot.org dovecot at dovecot.org
Thu Apr 17 08:30:16 UTC 2014


details:   http://hg.dovecot.org/dovecot-2.2/rev/e4119adae01d
changeset: 17231:e4119adae01d
user:      Timo Sirainen <tss at iki.fi>
date:      Thu Apr 17 10:26:11 2014 +0200
description:
fts: Added unload() method to fts-parsers to allow them to cleanup before plugin unload.

diffstat:

 src/plugins/fts/fts-parser-html.c   |   3 ++-
 src/plugins/fts/fts-parser-script.c |   3 ++-
 src/plugins/fts/fts-parser.c        |  10 ++++++++++
 src/plugins/fts/fts-parser.h        |   3 +++
 src/plugins/fts/fts-plugin.c        |   2 ++
 5 files changed, 19 insertions(+), 2 deletions(-)

diffs (75 lines):

diff -r f68ec8bd4afa -r e4119adae01d src/plugins/fts/fts-parser-html.c
--- a/src/plugins/fts/fts-parser-html.c	Thu Apr 17 10:17:09 2014 +0200
+++ b/src/plugins/fts/fts-parser-html.c	Thu Apr 17 10:26:11 2014 +0200
@@ -262,5 +262,6 @@
 struct fts_parser_vfuncs fts_parser_html = {
 	fts_parser_html_try_init,
 	fts_parser_html_more,
-	fts_parser_html_deinit
+	fts_parser_html_deinit,
+	NULL
 };
diff -r f68ec8bd4afa -r e4119adae01d src/plugins/fts/fts-parser-script.c
--- a/src/plugins/fts/fts-parser-script.c	Thu Apr 17 10:17:09 2014 +0200
+++ b/src/plugins/fts/fts-parser-script.c	Thu Apr 17 10:26:11 2014 +0200
@@ -266,5 +266,6 @@
 struct fts_parser_vfuncs fts_parser_script = {
 	fts_parser_script_try_init,
 	fts_parser_script_more,
-	fts_parser_script_deinit
+	fts_parser_script_deinit,
+	NULL
 };
diff -r f68ec8bd4afa -r e4119adae01d src/plugins/fts/fts-parser.c
--- a/src/plugins/fts/fts-parser.c	Thu Apr 17 10:17:09 2014 +0200
+++ b/src/plugins/fts/fts-parser.c	Thu Apr 17 10:26:11 2014 +0200
@@ -89,3 +89,13 @@
 	else
 		i_free(parser);
 }
+
+void fts_parsers_unload(void)
+{
+	unsigned int i;
+
+	for (i = 0; i < N_ELEMENTS(parsers); i++) {
+		if (parsers[i]->unload != NULL)
+			parsers[i]->unload();
+	}
+}
diff -r f68ec8bd4afa -r e4119adae01d src/plugins/fts/fts-parser.h
--- a/src/plugins/fts/fts-parser.h	Thu Apr 17 10:17:09 2014 +0200
+++ b/src/plugins/fts/fts-parser.h	Thu Apr 17 10:26:11 2014 +0200
@@ -10,6 +10,7 @@
 				       const char *content_disposition);
 	void (*more)(struct fts_parser *parser, struct message_block *block);
 	void (*deinit)(struct fts_parser *parser);
+	void (*unload)(void);
 };
 
 struct fts_parser {
@@ -31,4 +32,6 @@
 void fts_parser_more(struct fts_parser *parser, struct message_block *block);
 void fts_parser_deinit(struct fts_parser **parser);
 
+void fts_parsers_unload(void);
+
 #endif
diff -r f68ec8bd4afa -r e4119adae01d src/plugins/fts/fts-plugin.c
--- a/src/plugins/fts/fts-plugin.c	Thu Apr 17 10:17:09 2014 +0200
+++ b/src/plugins/fts/fts-plugin.c	Thu Apr 17 10:26:11 2014 +0200
@@ -2,6 +2,7 @@
 
 #include "lib.h"
 #include "mail-storage-hooks.h"
+#include "fts-parser.h"
 #include "fts-storage.h"
 #include "fts-plugin.h"
 
@@ -22,5 +23,6 @@
 
 void fts_plugin_deinit(void)
 {
+	fts_parsers_unload();
 	mail_storage_hooks_remove(&fts_mail_storage_hooks);
 }


More information about the dovecot-cvs mailing list