From ef09072e34def09f0fa60662493e29f6aa22666d Mon Sep 17 00:00:00 2001 From: hiro Date: Wed, 2 Dec 2015 08:55:32 +0000 Subject: fixed regex match when using Oniguruma. git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@3495 ee746299-78ed-0310-b773-934348b2243d --- ChangeLog | 7 ++++++- libsylph/filter.c | 5 ++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index b737e1c5..139b2e45 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,11 @@ +2015-12-02 + + * libsylph/filter.c: strmatch_regex(): fixed regex match when using + Oniguruma (r3481 made it match only the head of searched string). + 2015-11-27 - * version 3.5.0 + * version 3.5.0rc 2015-11-27 diff --git a/libsylph/filter.c b/libsylph/filter.c index 873e32df..1a3bb4ae 100644 --- a/libsylph/filter.c +++ b/libsylph/filter.c @@ -341,6 +341,7 @@ static gboolean strmatch_regex(const gchar *haystack, const gchar *needle) OnigErrorInfo err_info; const UChar *ptn = (const UChar *)needle; const UChar *str = (const UChar *)haystack; + size_t haystack_len; ret = onig_new(®, ptn, ptn + strlen(needle), ONIG_OPTION_IGNORECASE|ONIG_OPTION_EXTEND, @@ -349,7 +350,9 @@ static gboolean strmatch_regex(const gchar *haystack, const gchar *needle) if (ret != ONIG_NORMAL) return FALSE; - ret = onig_match(reg, str, str + strlen(haystack), str, NULL, 0); + haystack_len = strlen(haystack); + ret = onig_search(reg, str, str + haystack_len, + str, str + haystack_len, NULL, 0); onig_free(reg); if (ret >= 0) -- cgit v1.2.3