Skip to content
Snippets Groups Projects
Commit ed5196bc authored by Stephan Bosch's avatar Stephan Bosch
Browse files

lib-sieve: Moved lexical scanner to system pool.

parent 665fba16
No related branches found
No related tags found
No related merge requests found
......@@ -64,7 +64,6 @@ const struct sieve_lexer *sieve_lexer_create
(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 @@ const struct sieve_lexer *sieve_lexer_create
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 @@ const struct sieve_lexer *sieve_lexer_create
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 @@ const struct sieve_lexer *sieve_lexer_create
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);
pool_unref(&scanner->pool);
*lexer = NULL;
i_free(scanner);
*_lexer = NULL;
}
/*
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment

Consent

On this website, we use the web analytics service Matomo to analyze and review the use of our website. Through the collected statistics, we can improve our offerings and make them more appealing for you. Here, you can decide whether to allow us to process your data and set corresponding cookies for these purposes, in addition to technically necessary cookies. Further information on data protection—especially regarding "cookies" and "Matomo"—can be found in our privacy policy. You can withdraw your consent at any time.