From: Vsevolod Stakhov Date: Thu, 5 Mar 2015 16:51:36 +0000 (+0000) Subject: Implement match. X-Git-Tag: 0.9.0~555 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=988cb2cc8399b16042f06108954af9abf4cf46a5;p=rspamd.git Implement match. --- diff --git a/src/libutil/regexp.c b/src/libutil/regexp.c index 57515703e..06555f57f 100644 --- a/src/libutil/regexp.c +++ b/src/libutil/regexp.c @@ -327,7 +327,7 @@ rspamd_regexp_search (rspamd_regexp_t *re, const gchar *text, gsize len, *start = mt + ovec[0]; } if (end) { - *end = mt + ovec[1]; + *end = mt + ovec[0] + ovec[1]; } return TRUE; @@ -340,9 +340,17 @@ gboolean rspamd_regexp_match (rspamd_regexp_t *re, const gchar *text, gsize len, gboolean raw) { + const gchar *start = NULL, *end = NULL; + g_assert (re != NULL); g_assert (text != NULL); + if (rspamd_regexp_search (re, text, len, &start, &end, raw)) { + if (start == text && end == text + len) { + return TRUE; + } + } + return FALSE; }