const gchar *begin, *end, *p, *src, *start;
gchar *dbegin, *dend;
struct rspamd_regexp_element *result;
+ rspamd_regexp_t *re;
GError *err = NULL;
GString *re_flags;
return NULL;
}
+ if ((re = rspamd_regexp_cache_query (NULL, line, NULL)) != NULL) {
+ return ((struct rspamd_regexp_element *)rspamd_regexp_get_ud (re));
+ }
+
src = line;
result = rspamd_mempool_alloc0 (pool, sizeof (struct rspamd_regexp_element));
/* Skip whitespaces */
g_string_append_c (re_flags, 'r');
}
- result->regexp = rspamd_regexp_cache_create (NULL, dbegin, re_flags->str,
+ result->regexp = rspamd_regexp_new (dbegin, re_flags->str,
&err);
g_string_free (re_flags, TRUE);
(rspamd_mempool_destruct_t) rspamd_regexp_unref,
(void *)result->regexp);
+ rspamd_regexp_set_ud (result->regexp, result);
+
+ rspamd_regexp_cache_insert (NULL, line, NULL, result->regexp);
+
*dend = '/';
return result;