grep-commit
[Top][All Lists]
Advanced

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

grep branch, master, updated. v2.18-54-g3ef4c8e


From: Paul Eggert
Subject: grep branch, master, updated. v2.18-54-g3ef4c8e
Date: Tue, 08 Apr 2014 04:07:42 +0000

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  3ef4c8ee04951b34a5fbbe6d6e3287a3182f6059 (commit)
      from  e9cf5ae927a462ac0b224668b39e0a778e2661c5 (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=3ef4c8ee04951b34a5fbbe6d6e3287a3182f6059


commit 3ef4c8ee04951b34a5fbbe6d6e3287a3182f6059
Author: Norihiro Tanaka <address@hidden>
Date:   Tue Apr 1 23:48:16 2014 +0900

    grep: prefer regex to DFA for ANYCHAR in multibyte locales
    
    * src/dfa.c (dfa_state): New member has_mbcset.
    Rename backref to has_backref, and make it of type bool too.
    All uses changed.
    (state_index, dfastate): Initialize new member.
    (dfaexec): Prefer regex to DFA for ANYCHAR in multibyte locales.

diff --git a/src/dfa.c b/src/dfa.c
index d8744d7..7bab84d 100644
--- a/src/dfa.c
+++ b/src/dfa.c
@@ -288,7 +288,8 @@ typedef struct
   size_t hash;                  /* Hash of the positions of this state.  */
   position_set elems;           /* Positions this state could match.  */
   unsigned char context;        /* Context from previous state.  */
-  char backref;                 /* True if this state matches a \<digit>.  */
+  bool has_backref;             /* True if this state matches a \<digit>.  */
+  bool has_mbcset;              /* True if this state matches a MBCSET.  */
   unsigned short constraint;    /* Constraint for this state to accept.  */
   token first_end;              /* Token value of the first END in elems.  */
   position_set mbps;            /* Positions which can match multibyte
@@ -2128,7 +2129,8 @@ state_index (struct dfa *d, position_set const *s, int 
context)
   alloc_position_set (&d->states[i].elems, s->nelem);
   copy (s, &d->states[i].elems);
   d->states[i].context = context;
-  d->states[i].backref = 0;
+  d->states[i].has_backref = false;
+  d->states[i].has_mbcset = false;
   d->states[i].constraint = 0;
   d->states[i].first_end = 0;
   d->states[i].mbps.nelem = 0;
@@ -2146,7 +2148,7 @@ state_index (struct dfa *d, position_set const *s, int 
context)
     else if (d->tokens[s->elems[j].index] == BACKREF)
       {
         d->states[i].constraint = NO_CONSTRAINT;
-        d->states[i].backref = 1;
+        d->states[i].has_backref = true;
       }
 
   ++d->sindex;
@@ -2609,6 +2611,7 @@ dfastate (state_num s, struct dfa *d, state_num trans[])
           if (d->states[s].mbps.nelem == 0)
             alloc_position_set (&d->states[s].mbps, 1);
           insert (pos, &(d->states[s].mbps));
+          d->states[s].has_mbcset |= (d->tokens[pos.index] == MBCSET);
           continue;
         }
       else
@@ -3413,7 +3416,7 @@ dfaexec (struct dfa *d, char const *begin, char *end,
                  better performance (up to 25% better on [a-z], for
                  example) and enables support for collating symbols and
                  equivalence classes.  */
-              if (backref)
+              if (d->states[s].has_mbcset && backref)
                 {
                   *backref = 1;
                   *end = saved_end;
@@ -3447,7 +3450,7 @@ dfaexec (struct dfa *d, char const *begin, char *end,
           if (d->success[s] & sbit[*p])
             {
               if (backref)
-                *backref = (d->states[s].backref != 0);
+                *backref = d->states[s].has_backref;
               *end = saved_end;
               return (char *) p;
             }

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

Summary of changes:
 src/dfa.c |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)


hooks/post-receive
-- 
grep



reply via email to

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