From owner-svn-src-user@FreeBSD.ORG Wed Jun 1 17:17:03 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 2EF521065670; Wed, 1 Jun 2011 17:17:03 +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 1EB9F8FC0C; Wed, 1 Jun 2011 17:17:03 +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 p51HH3x9079336; Wed, 1 Jun 2011 17:17:03 GMT (envelope-from gabor@svn.freebsd.org) Received: (from gabor@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p51HH3KC079334; Wed, 1 Jun 2011 17:17:03 GMT (envelope-from gabor@svn.freebsd.org) Message-Id: <201106011717.p51HH3KC079334@svn.freebsd.org> From: Gabor Kovesdan Date: Wed, 1 Jun 2011 17:17:02 +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: r222573 - 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: Wed, 01 Jun 2011 17:17:03 -0000 Author: gabor Date: Wed Jun 1 17:17:02 2011 New Revision: 222573 URL: http://svn.freebsd.org/changeset/base/222573 Log: - Add support for BSD-specific REG_PEND Obtained from: The NetBSD Project Modified: user/gabor/tre-integration/contrib/tre/lib/regcomp.c Modified: user/gabor/tre-integration/contrib/tre/lib/regcomp.c ============================================================================== --- user/gabor/tre-integration/contrib/tre/lib/regcomp.c Wed Jun 1 16:54:33 2011 (r222572) +++ user/gabor/tre-integration/contrib/tre/lib/regcomp.c Wed Jun 1 17:17:02 2011 (r222573) @@ -102,7 +102,18 @@ tre_regncomp(regex_t *preg, const char * int tre_regcomp(regex_t *preg, const char *regex, int cflags) { - return tre_regncomp(preg, regex, regex ? strlen(regex) : 0, cflags); + size_t len; + + if (cflags & REG_PEND) + { + if (preg->re_endp >= regex) + len = preg->re_endp - regex; + else + len = 0; + return tre_regncomp(preg, regex, len, cflags); + } + else + return tre_regncomp(preg, regex, regex ? strlen(regex) : 0, cflags); } @@ -116,7 +127,18 @@ tre_regwncomp(regex_t *preg, const wchar int tre_regwcomp(regex_t *preg, const wchar_t *regex, int cflags) { - return tre_compile(preg, regex, regex ? wcslen(regex) : 0, cflags); + size_t len; + + if (cflags & REG_PEND) + { + if (preg->re_endp >= regex) + len = preg->re_endp - regex; + else + len = 0; + return tre_compilepreg, regex, len, cflags); + } + else + return tre_compile(preg, regex, regex ? wcslen(regex) : 0, cflags); } #endif /* TRE_WCHAR */