diff options
author | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2009-04-21 03:47:28 +0400 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2009-04-21 03:47:28 +0400 |
commit | d0dbd1aa3a95c5a1f354458033f6af2b8f01a4a5 (patch) | |
tree | 8eeb5071c8ddfd02a16656cc94a1e69892324b1e /src/expressions.c | |
parent | 91cbed7c0143bd581f0034c57ea00da479412784 (diff) | |
download | rspamd-d0dbd1aa3a95c5a1f354458033f6af2b8f01a4a5.tar.gz rspamd-d0dbd1aa3a95c5a1f354458033f6af2b8f01a4a5.zip |
* Add raw mode flag for improving performance by avoiding expensive utf8 transforms
* Improve FreeBSD start script by adding config test precmd
Diffstat (limited to 'src/expressions.c')
-rw-r--r-- | src/expressions.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/expressions.c b/src/expressions.c index 89ec55e6c..cd92e979b 100644 --- a/src/expressions.c +++ b/src/expressions.c @@ -484,7 +484,7 @@ parse_expression (memory_pool_t *pool, char *line) * Rspamd regexp utility functions */ struct rspamd_regexp* -parse_regexp (memory_pool_t *pool, char *line) +parse_regexp (memory_pool_t *pool, char *line, gboolean raw_mode) { char *begin, *end, *p, *src; struct rspamd_regexp *result, *check; @@ -621,6 +621,10 @@ parse_regexp (memory_pool_t *pool, char *line) *end = '\0'; + if (raw_mode) { + regexp_flags |= G_REGEX_RAW; + } + /* Avoid multiply regexp structures for similar regexps */ if ((check = (struct rspamd_regexp *)re_cache_check (begin)) != NULL) { /* Additional check for headers */ @@ -828,7 +832,7 @@ rspamd_content_type_compare_param (struct worker_task *task, GList *args) if (*param_pattern == '/') { /* This is regexp, so compile and create g_regexp object */ if ((re = re_cache_check (param_pattern)) == NULL) { - re = parse_regexp (task->cfg->cfg_pool, param_pattern); + re = parse_regexp (task->cfg->cfg_pool, param_pattern, task->cfg->raw_mode); if (re == NULL) { msg_warn ("rspamd_content_type_compare_param: cannot compile regexp for function"); return FALSE; @@ -926,7 +930,7 @@ rspamd_content_type_is_subtype (struct worker_task *task, GList *args) if (*param_pattern == '/') { /* This is regexp, so compile and create g_regexp object */ if ((re = re_cache_check (param_pattern)) == NULL) { - re = parse_regexp (task->cfg->cfg_pool, param_pattern); + re = parse_regexp (task->cfg->cfg_pool, param_pattern, task->cfg->raw_mode); if (re == NULL) { msg_warn ("rspamd_content_type_compare_param: cannot compile regexp for function"); return FALSE; @@ -985,7 +989,7 @@ rspamd_content_type_is_type (struct worker_task *task, GList *args) if (*param_pattern == '/') { /* This is regexp, so compile and create g_regexp object */ if ((re = re_cache_check (param_pattern)) == NULL) { - re = parse_regexp (task->cfg->cfg_pool, param_pattern); + re = parse_regexp (task->cfg->cfg_pool, param_pattern, task->cfg->raw_mode); if (re == NULL) { msg_warn ("rspamd_content_type_compare_param: cannot compile regexp for function"); return FALSE; @@ -1167,7 +1171,7 @@ compare_subtype (struct worker_task *task, const localContentType *ct, char *sub if (*subtype == '/') { /* This is regexp, so compile and create g_regexp object */ if ((re = re_cache_check (subtype)) == NULL) { - re = parse_regexp (task->cfg->cfg_pool, subtype); + re = parse_regexp (task->cfg->cfg_pool, subtype, task->cfg->raw_mode); if (re == NULL) { msg_warn ("compare_subtype: cannot compile regexp for function"); return FALSE; @@ -1234,7 +1238,7 @@ common_has_content_part (struct worker_task *task, char *param_type, char *param if (*param_type == '/') { /* This is regexp, so compile and create g_regexp object */ if ((re = re_cache_check (param_type)) == NULL) { - re = parse_regexp (task->cfg->cfg_pool, param_type); + re = parse_regexp (task->cfg->cfg_pool, param_type, task->cfg->raw_mode); if (re == NULL) { msg_warn ("rspamd_has_content_part: cannot compile regexp for function"); cur = g_list_next (cur); |