From owner-svn-src-user@FreeBSD.ORG Thu Sep 15 15:28:41 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BF886106566B; Thu, 15 Sep 2011 15:28:41 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AF9398FC08; Thu, 15 Sep 2011 15:28:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8FFSfBa079291; Thu, 15 Sep 2011 15:28:41 GMT (envelope-from gabor@svn.freebsd.org) Received: (from gabor@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8FFSfQX079289; Thu, 15 Sep 2011 15:28:41 GMT (envelope-from gabor@svn.freebsd.org) Message-Id: <201109151528.p8FFSfQX079289@svn.freebsd.org> From: Gabor Kovesdan Date: Thu, 15 Sep 2011 15:28:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225591 - user/gabor/tre-integration/contrib/tre/lib X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Sep 2011 15:28:41 -0000 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);