dovecot-2.2-pigeonhole: lib-sieve: Moved lexical scanner to syst...

pigeonhole at rename-it.nl pigeonhole at rename-it.nl
Fri Mar 6 20:39:12 UTC 2015


details:   http://hg.rename-it.nl/dovecot-2.2-pigeonhole/rev/c74220e16e0f
changeset: 1997:c74220e16e0f
user:      Stephan Bosch <stephan at rename-it.nl>
date:      Fri Mar 06 21:36:40 2015 +0100
description:
lib-sieve: Moved lexical scanner to system pool.

diffstat:

 src/lib-sieve/sieve-lexer.c |  24 ++++++++++--------------
 1 files changed, 10 insertions(+), 14 deletions(-)

diffs (59 lines):

diff -r 465ec119b394 -r c74220e16e0f src/lib-sieve/sieve-lexer.c
--- a/src/lib-sieve/sieve-lexer.c	Fri Mar 06 21:14:01 2015 +0100
+++ b/src/lib-sieve/sieve-lexer.c	Fri Mar 06 21:36:40 2015 +0100
@@ -64,7 +64,6 @@
 (struct sieve_script *script, struct sieve_error_handler *ehandler,
 	enum sieve_error *error_r)
 {
-	pool_t pool;
 	struct sieve_lexical_scanner *scanner;
 	struct sieve_instance *svinst = sieve_script_svinst(script);
 	struct istream *stream;
@@ -86,9 +85,7 @@
 		return NULL;
 	}
 
-	pool = pool_alloconly_create("sieve_lexer_scanner", 1024);
-	scanner = p_new(pool, struct sieve_lexical_scanner, 1);
-	scanner->pool = pool;
+	scanner = i_new(struct sieve_lexical_scanner, 1);
 	scanner->lexer.scanner = scanner;
 
 	scanner->ehandler = ehandler;
@@ -105,7 +102,7 @@
 	scanner->buffer_pos = 0;
 
 	scanner->lexer.token_type = STT_NONE;
-	scanner->lexer.token_str_value = str_new(pool, 256);
+	scanner->lexer.token_str_value = str_new(default_pool, 256);
 	scanner->lexer.token_int_value = 0;
 	scanner->lexer.token_line = 1;
 
@@ -114,19 +111,18 @@
 	return &scanner->lexer;
 }
 
-void sieve_lexer_free(const struct sieve_lexer **lexer)
+void sieve_lexer_free(const struct sieve_lexer **_lexer)
 {
-	struct sieve_lexical_scanner *scanner = (*lexer)->scanner;
+	const struct sieve_lexer *lexer = *_lexer;
+	struct sieve_lexical_scanner *scanner = lexer->scanner;
 
 	i_stream_unref(&scanner->input);
+	sieve_script_unref(&scanner->script);
+	sieve_error_handler_unref(&scanner->ehandler);
+	str_free(&scanner->lexer.token_str_value);
 
-	sieve_script_unref(&scanner->script);
-
-	sieve_error_handler_unref(&scanner->ehandler);
-
-	pool_unref(&scanner->pool);
-
-	*lexer = NULL;
+	i_free(scanner);
+	*_lexer = NULL;
 }
 
 /*


More information about the dovecot-cvs mailing list