bug-grep
[Top][All Lists]
Advanced

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

[PATCH 30/34] maint: dfa: simplify several expressions


From: Jim Meyering
Subject: [PATCH 30/34] maint: dfa: simplify several expressions
Date: Thu, 15 Sep 2011 12:28:13 +0200

From: Jim Meyering <address@hidden>

* src/dfa.c (dfainit): Set d->mb_cur_max unconditionally, now
that MB_CUR_MAX is always usable.  With that, simplify all
"MBS_SUPPORT && d->mb_cur_max > 1" to simply "d->mb_cur_max > 1".
(dfastate, dfaexec, dfainit, dfafree): Simplify, removing each
now-unnecessary "MBS_SUPPORT &&".
---
 src/dfa.c |   19 +++++++++----------
 1 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/src/dfa.c b/src/dfa.c
index 19bb59a..ee4ba3c 100644
--- a/src/dfa.c
+++ b/src/dfa.c
@@ -2536,7 +2536,7 @@ dfastate (int s, struct dfa *d, int trans[])
         for (k = 0; k < d->follows[grps[i].elems[j].index].nelem; ++k)
           insert(d->follows[grps[i].elems[j].index].elems[k], &follows);

-      if (MBS_SUPPORT && d->mb_cur_max > 1)
+      if (d->mb_cur_max > 1)
         {
           /* If a token in follows.elems is not 1st byte of a multibyte
              character, or the states of follows must accept the bytes
@@ -3238,7 +3238,7 @@ dfaexec (struct dfa *d, char const *begin, char *end,
   saved_end = *(unsigned char *) end;
   *end = eol;

-  if (MBS_SUPPORT && d->mb_cur_max > 1)
+  if (d->mb_cur_max > 1)
     {
       MALLOC(mblen_buf, end - begin + 2);
       MALLOC(inputwcs, end - begin + 2);
@@ -3248,7 +3248,7 @@ dfaexec (struct dfa *d, char const *begin, char *end,

   for (;;)
     {
-      if (MBS_SUPPORT && d->mb_cur_max > 1)
+      if (d->mb_cur_max > 1)
         while ((t = trans[s]))
           {
             if (p > buf_end)
@@ -3300,7 +3300,7 @@ dfaexec (struct dfa *d, char const *begin, char *end,
             {
               if (backref)
                 *backref = (d->states[s].backref != 0);
-              if (MBS_SUPPORT && d->mb_cur_max > 1)
+              if (d->mb_cur_max > 1)
                 {
                   free(mblen_buf);
                   free(inputwcs);
@@ -3310,7 +3310,7 @@ dfaexec (struct dfa *d, char const *begin, char *end,
             }

           s1 = s;
-          if (MBS_SUPPORT && d->mb_cur_max > 1)
+          if (d->mb_cur_max > 1)
             {
               /* Can match with a multibyte character (and multicharacter
                  collating element).  Transition table might be updated.  */
@@ -3328,14 +3328,14 @@ dfaexec (struct dfa *d, char const *begin, char *end,
           if (count)
             ++*count;

-          if (MBS_SUPPORT && d->mb_cur_max > 1)
+          if (d->mb_cur_max > 1)
             prepare_wc_buf ((const char *) p, end);
         }

       /* Check if we've run off the end of the buffer. */
       if ((char *) p > end)
         {
-          if (MBS_SUPPORT && d->mb_cur_max > 1)
+          if (d->mb_cur_max > 1)
             {
               free(mblen_buf);
               free(inputwcs);
@@ -3408,8 +3408,8 @@ dfainit (struct dfa *d)
   d->talloc = 1;
   MALLOC(d->tokens, d->talloc);

-#if MBS_SUPPORT
   d->mb_cur_max = MB_CUR_MAX;
+
   if (d->mb_cur_max > 1)
     {
       d->nmultibyte_prop = 1;
@@ -3417,7 +3417,6 @@ dfainit (struct dfa *d)
       d->mbcsets_alloc = 1;
       MALLOC(d->mbcsets, d->mbcsets_alloc);
     }
-#endif
 }

 static void
@@ -3471,7 +3470,7 @@ dfafree (struct dfa *d)
   free(d->charclasses);
   free(d->tokens);

-  if (MBS_SUPPORT && d->mb_cur_max > 1)
+  if (d->mb_cur_max > 1)
     free_mbdata(d);

   for (i = 0; i < d->sindex; ++i) {
-- 
1.7.7.rc0.362.g5a14




reply via email to

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