svn commit: r224767 - user/gabor/tre-integration/contrib/tre/lib

Gabor Kovesdan gabor at FreeBSD.org
Wed Aug 10 21:39:47 UTC 2011


Author: gabor
Date: Wed Aug 10 21:39:47 2011
New Revision: 224767
URL: http://svn.freebsd.org/changeset/base/224767

Log:
  - Fix a wchar-cleanness issue
  - TRE-specific style

Modified:
  user/gabor/tre-integration/contrib/tre/lib/fastmatch.c

Modified: user/gabor/tre-integration/contrib/tre/lib/fastmatch.c
==============================================================================
--- user/gabor/tre-integration/contrib/tre/lib/fastmatch.c	Wed Aug 10 21:32:13 2011	(r224766)
+++ user/gabor/tre-integration/contrib/tre/lib/fastmatch.c	Wed Aug 10 21:39:47 2011	(r224767)
@@ -475,38 +475,46 @@ tre_fastexec(const fastmatch_t *fg, cons
 	shift = fg->len;
     }
 
-  /* XXX: make wchar-clean */
   /* Only try once at the beginning or ending of the line. */
-  if (fg->bol || fg->eol) {
-    /* Simple text comparison. */
-    if (!((fg->bol && fg->eol) && (len != fg->len))) {
-      /* Determine where in data to start search at. */
-      j = fg->eol ? len - fg->len : 0;
-      SKIP_CHARS(j);
-      COMPARE;
-      if (mismatch == REG_OK) {
-	pmatch[0].rm_so = j;
-	pmatch[0].rm_eo = j + fg->len;
-	return REG_OK;
-      }
+  if (fg->bol || fg->eol)
+    {
+      /* Simple text comparison. */
+      if (!((fg->bol && fg->eol) &&
+	  (type == STR_WIDE ? (wlen != fg->wlen) : (len != fg->len))))
+	{
+	  /* Determine where in data to start search at. */
+	  j = fg->eol ? len - (type == STR_WIDE ? fg->wlen : fg->len) : 0;
+	  SKIP_CHARS(j);
+	  COMPARE;
+	  if (mismatch == REG_OK)
+	    {
+	      pmatch[0].rm_so = j;
+	      pmatch[0].rm_eo = j + (type == STR_WIDE ? fg->wlen : fg->len);
+	      return REG_OK;
+            }
+        }
     }
-  } else {
-    /* Quick Search algorithm. */
-    j = 0;
-    do {
-      SKIP_CHARS(j);
-      COMPARE;
-      if (mismatch == REG_OK) {
-	pmatch[0].rm_so = j;
-	pmatch[0].rm_eo = j + ((type == STR_WIDE) ? fg->wlen : fg->len);
-	return REG_OK;
-      } else if (mismatch > 0)
-        return mismatch;
-      mismatch = -mismatch - 1;
-      SHIFT;
-    } while (!IS_OUT_OF_BOUNDS);
-  }
-  return ret;
+  else
+    {
+      /* Quick Search algorithm. */
+      j = 0;
+      do
+	{
+	  SKIP_CHARS(j);
+	  COMPARE;
+	  if (mismatch == REG_OK)
+	    {
+	      pmatch[0].rm_so = j;
+	      pmatch[0].rm_eo = j + ((type == STR_WIDE) ? fg->wlen : fg->len);
+	      return REG_OK;
+	    }
+	  else if (mismatch > 0)
+	    return mismatch;
+	  mismatch = -mismatch - 1;
+	  SHIFT;
+        } while (!IS_OUT_OF_BOUNDS);
+    }
+    return ret;
 }
 
 void


More information about the svn-src-user mailing list