From owner-svn-src-user@FreeBSD.ORG Thu Aug 18 15:31:32 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 6D53A106564A; Thu, 18 Aug 2011 15:31:32 +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 43F1D8FC13; Thu, 18 Aug 2011 15:31:32 +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 p7IFVWsJ062955; Thu, 18 Aug 2011 15:31:32 GMT (envelope-from gabor@svn.freebsd.org) Received: (from gabor@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7IFVWud062952; Thu, 18 Aug 2011 15:31:32 GMT (envelope-from gabor@svn.freebsd.org) Message-Id: <201108181531.p7IFVWud062952@svn.freebsd.org> From: Gabor Kovesdan Date: Thu, 18 Aug 2011 15:31:32 +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: r224971 - 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, 18 Aug 2011 15:31:32 -0000 Author: gabor Date: Thu Aug 18 15:31:31 2011 New Revision: 224971 URL: http://svn.freebsd.org/changeset/base/224971 Log: - Support REG_PEND in the fast matching functions - Fall back to strlen() when the end pointer is invalid Modified: user/gabor/tre-integration/contrib/tre/lib/fastmatch.c user/gabor/tre-integration/contrib/tre/lib/regcomp.c Modified: user/gabor/tre-integration/contrib/tre/lib/fastmatch.c ============================================================================== --- user/gabor/tre-integration/contrib/tre/lib/fastmatch.c Thu Aug 18 15:13:08 2011 (r224970) +++ user/gabor/tre-integration/contrib/tre/lib/fastmatch.c Thu Aug 18 15:31:31 2011 (r224971) @@ -121,13 +121,29 @@ tre_fastncomp(fastmatch_t *preg, const c int tre_fixcomp(fastmatch_t *preg, const char *regex, int cflags) { - return tre_fixncomp(preg, regex, regex ? strlen(regex) : 0, cflags); + if (cflags & REG_PEND) + { + len = (preg->re_endp >= regex) + ? preg->re_endp - regex + : 0; + return tre_fixncomp(preg, regex, len ? strlen(regex) : 0, cflags); + } + else + return tre_fixncomp(preg, regex, regex ? strlen(regex) : 0, cflags); } int tre_fastcomp(fastmatch_t *preg, const char *regex, int cflags) { - return tre_fastncomp(preg, regex, regex ? strlen(regex) : 0, cflags); + if (cflags & REG_PEND) + { + len = (preg->re_endp >= regex) + ? preg->re_endp - regex + : 0; + return tre_fastncomp(preg, regex, len ? strlen(regex) : 0, cflags); + } + else + return tre_fastncomp(preg, regex, regex ? strlen(regex) : 0, cflags); } int Modified: user/gabor/tre-integration/contrib/tre/lib/regcomp.c ============================================================================== --- user/gabor/tre-integration/contrib/tre/lib/regcomp.c Thu Aug 18 15:13:08 2011 (r224970) +++ user/gabor/tre-integration/contrib/tre/lib/regcomp.c Thu Aug 18 15:31:31 2011 (r224971) @@ -118,7 +118,7 @@ tre_regcomp(regex_t *preg, const char *r len = (preg->re_endp >= regex) ? preg->re_endp - regex : 0; - return tre_regncomp(preg, regex, len, cflags); + return tre_regncomp(preg, regex, len ? strlen(regex) : 0, cflags); } else return tre_regncomp(preg, regex, regex ? strlen(regex) : 0, cflags);