Date: Thu, 15 Sep 2011 15:28:41 +0000 (UTC) From: Gabor Kovesdan <gabor@FreeBSD.org> To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r225591 - user/gabor/tre-integration/contrib/tre/lib Message-ID: <201109151528.p8FFSfQX079289@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: gabor Date: Thu Sep 15 15:28:41 2011 New Revision: 225591 URL: http://svn.freebsd.org/changeset/base/225591 Log: - Check nmatch not only REG_NOSUB if we can store submatches in pmatch Modified: user/gabor/tre-integration/contrib/tre/lib/tre-fastmatch.c Modified: user/gabor/tre-integration/contrib/tre/lib/tre-fastmatch.c ============================================================================== --- user/gabor/tre-integration/contrib/tre/lib/tre-fastmatch.c Thu Sep 15 15:18:57 2011 (r225590) +++ user/gabor/tre-integration/contrib/tre/lib/tre-fastmatch.c Thu Sep 15 15:28:41 2011 (r225591) @@ -855,7 +855,7 @@ badpat: */ int tre_match_fast(const fastmatch_t *fg, const void *data, size_t len, - tre_str_type_t type, int nmatch __unused, regmatch_t pmatch[], int eflags) + tre_str_type_t type, int nmatch, regmatch_t pmatch[], int eflags) { unsigned int shift, u = 0, v = 0; ssize_t j = 0; @@ -880,7 +880,7 @@ tre_match_fast(const fastmatch_t *fg, co /* Shortcut for empty pattern */ if (fg->matchall) { - if (!fg->nosub) + if (!fg->nosub && nmatch >= 1) { pmatch[0].rm_so = 0; pmatch[0].rm_eo = len; @@ -939,7 +939,7 @@ tre_match_fast(const fastmatch_t *fg, co { if (fg->word && !IS_ON_WORD_BOUNDARY) return ret; - if (!fg->nosub) + if (!fg->nosub && nmatch >= 1) { pmatch[0].rm_so = j; pmatch[0].rm_eo = j + (type == STR_WIDE ? fg->wlen : fg->len); @@ -963,7 +963,7 @@ tre_match_fast(const fastmatch_t *fg, co CHECK_BOL_ANCHOR; if (fg->eol) CHECK_EOL_ANCHOR; - if (!fg->nosub) + if (!fg->nosub && nmatch >= 1) { pmatch[0].rm_so = j; pmatch[0].rm_eo = j + ((type == STR_WIDE) ? fg->wlen : fg->len);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201109151528.p8FFSfQX079289>