svn commit: r225590 - in user/gabor/tre-integration: contrib/tre/lib include

Gabor Kovesdan gabor at FreeBSD.org
Thu Sep 15 15:18:58 UTC 2011


Author: gabor
Date: Thu Sep 15 15:18:57 2011
New Revision: 225590
URL: http://svn.freebsd.org/changeset/base/225590

Log:
  - Simplify REG_PEND code and add support for the same in wchar-compliant
    regcomp() variants

Modified:
  user/gabor/tre-integration/contrib/tre/lib/regcomp.c
  user/gabor/tre-integration/include/regex.h

Modified: user/gabor/tre-integration/contrib/tre/lib/regcomp.c
==============================================================================
--- user/gabor/tre-integration/contrib/tre/lib/regcomp.c	Thu Sep 15 15:12:18 2011	(r225589)
+++ user/gabor/tre-integration/contrib/tre/lib/regcomp.c	Thu Sep 15 15:18:57 2011	(r225590)
@@ -112,16 +112,8 @@ tre_regncomp(regex_t *preg, const char *
 int
 tre_regcomp(regex_t *preg, const char *regex, int cflags)
 {
-  size_t len;
-
-  if (cflags & REG_PEND)
-    {
-      if (preg->re_endp >= regex)
-	len = preg->re_endp - regex;
-      else
-	len = regex ? strlen(regex) : 0;
-      return tre_regncomp(preg, regex, len, cflags);
-   }
+  if ((cflags & REG_PEND) && (preg->re_endp >= regex))
+    return tre_regncomp(preg, regex, preg->re_endp - regex, cflags);
   else
     return tre_regncomp(preg, regex, regex ? strlen(regex) : 0, cflags);
 }
@@ -137,6 +129,9 @@ tre_regwncomp(regex_t *preg, const wchar
 int
 tre_regwcomp(regex_t *preg, const wchar_t *regex, int cflags)
 {
+  if ((cflags & REG_PEND) && (preg->re_wendp >= regex))
+    return tre_compile(preg, regex, preg->re_wendp - regex, cflags);
+  else
     return tre_compile(preg, regex, regex ? wcslen(regex) : 0, cflags);
 }
 #endif /* TRE_WCHAR */

Modified: user/gabor/tre-integration/include/regex.h
==============================================================================
--- user/gabor/tre-integration/include/regex.h	Thu Sep 15 15:12:18 2011	(r225589)
+++ user/gabor/tre-integration/include/regex.h	Thu Sep 15 15:18:57 2011	(r225590)
@@ -69,6 +69,9 @@ typedef struct {
   void *shortcut;  /* For internal use only. */
   void *heur;	   /* For internal use only. */
   const char *re_endp;
+#ifdef TRE_WCHAR
+  const wchar_t *re_wendp;
+#endif
 } regex_t;
 
 typedef struct {


More information about the svn-src-user mailing list