Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 1 Jun 2011 17:17:02 +0000 (UTC)
From:      Gabor Kovesdan <gabor@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   svn commit: r222573 - user/gabor/tre-integration/contrib/tre/lib
Message-ID:  <201106011717.p51HH3KC079334@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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 */
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201106011717.p51HH3KC079334>