grep-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

grep branch, master, updated. v2.25-77-gad468bb


From: Paul Eggert
Subject: grep branch, master, updated. v2.25-77-gad468bb
Date: Fri, 2 Sep 2016 15:44:46 +0000 (UTC)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "grep".

The branch, master has been updated
       via  ad468bbe3df027f29ecb236283084fb60b734f68 (commit)
      from  2c0190b809098530e3281fbc4ed1de44e17a65a3 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/grep.git/commit/?id=ad468bbe3df027f29ecb236283084fb60b734f68


commit ad468bbe3df027f29ecb236283084fb60b734f68
Author: Norihiro Tanaka <address@hidden>
Date:   Fri Sep 2 08:43:01 2016 -0700

    dfa: simplify and optimize at initial state in execution
    
    * src/dfa.c (skip_remains_mb): Remove argument *pwc.  Update calller.
    (dfaexec_main): Simplify and optimize at initial state (Bug#24261).

diff --git a/src/dfa.c b/src/dfa.c
index 1a4a90a..4cbaa75 100644
--- a/src/dfa.c
+++ b/src/dfa.c
@@ -3038,16 +3038,14 @@ transit_state (struct dfa *d, state_num s, unsigned 
char const **pp,
    Both P and MBP must be no larger than END.  */
 static unsigned char const *
 skip_remains_mb (struct dfa *d, unsigned char const *p,
-                 unsigned char const *mbp, char const *end, wint_t *wcp)
+                 unsigned char const *mbp, char const *end)
 {
-  wint_t wc = WEOF;
+  wint_t wc;
   if (d->syntax.never_trail[*p])
     return p;
   while (mbp < p)
     mbp += mbs_to_wchar (&wc, (char const *) mbp,
                          end - (char const *) mbp, d);
-  if (wcp != NULL)
-    *wcp = wc;
   return mbp;
 }
 
@@ -3104,46 +3102,22 @@ dfaexec_main (struct dfa *d, char const *begin, char 
*end, bool allow_nl,
 
   for (;;)
     {
-      if (multibyte)
+      while ((t = trans[s]) != NULL)
         {
-          while ((t = trans[s]) != NULL)
+          if (s < d->min_trcount)
             {
-              s1 = s;
-
-              if (s < d->min_trcount)
+              if (!multibyte || d->states[s].mbps.nelem == 0)
                 {
-                  if (d->min_trcount == 1)
-                    {
-                      if (d->states[s].mbps.nelem == 0)
-                        {
-                          do
-                            {
-                              while (t[*p] == 0)
-                                p++;
-                              p = mbp = skip_remains_mb (d, p, mbp, end, NULL);
-                            }
-                          while (t[*p] == 0);
-                        }
-                      else
-                        p = mbp = skip_remains_mb (d, p, mbp, end, NULL);
-                    }
-                  else
-                    {
-                      wint_t wc;
-                      mbp = skip_remains_mb (d, p, mbp, end, &wc);
-
-                      /* If d->min_trcount is greater than 1, maybe
-                         transit to another initial state after skip.  */
-                      if (p < mbp)
-                        {
-                          /* It's CTX_LETTER or CTX_NONE.  CTX_NEWLINE
-                             cannot happen, as we assume that a newline
-                             is always a single byte character.  */
-                          s1 = s = d->initstate_notbol;
-                          p = mbp;
-                        }
-                    }
+                  while (t[*p] == s)
+                    p++;
                 }
+              if (multibyte)
+                p = mbp = skip_remains_mb (d, p, mbp, end);
+            }
+
+          if (multibyte)
+            {
+              s1 = s;
 
               if (d->states[s].mbps.nelem == 0
                   || d->localeinfo.sbctowc[*p] != WEOF || (char *) p >= end)
@@ -3159,22 +3133,7 @@ dfaexec_main (struct dfa *d, char const *begin, char 
*end, bool allow_nl,
                   trans = d->trans;
                 }
             }
-        }
-      else
-        {
-          if (s == 0)
-            {
-              t = trans[s];
-              if (t)
-                {
-                  while (t[*p] == 0)
-                    p++;
-                  s1 = 0;
-                  s = t[*p++];
-                }
-            }
-
-          while ((t = trans[s]) != NULL)
+          else
             {
               s1 = t[*p++];
               t = trans[s1];
@@ -3185,6 +3144,11 @@ dfaexec_main (struct dfa *d, char const *begin, char 
*end, bool allow_nl,
                   s1 = tmp;     /* swap */
                   break;
                 }
+              if (s < d->min_trcount)
+                {
+                  while (t[*p] == s1)
+                    p++;
+                }
               s = t[*p++];
             }
         }
@@ -3209,6 +3173,9 @@ dfaexec_main (struct dfa *d, char const *begin, char 
*end, bool allow_nl,
           if (d->success[s] & d->syntax.sbit[*p])
             goto done;
 
+          if (multibyte && s < d->min_trcount)
+            p = mbp = skip_remains_mb (d, p, mbp, end);
+
           s1 = s;
           if (!multibyte || d->states[s].mbps.nelem == 0
               || (*p == eol && !allow_nl)

-----------------------------------------------------------------------

Summary of changes:
 src/dfa.c |   79 ++++++++++++++++++-------------------------------------------
 1 file changed, 23 insertions(+), 56 deletions(-)


hooks/post-receive
-- 
grep



reply via email to

[Prev in Thread] Current Thread [Next in Thread]