gawk-diffs
[Top][All Lists]
Advanced

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

[gawk-diffs] [SCM] gawk branch, master, updated. gawk-4.1.0-2357-g7a7d02


From: Arnold Robbins
Subject: [gawk-diffs] [SCM] gawk branch, master, updated. gawk-4.1.0-2357-g7a7d021
Date: Sun, 11 Dec 2016 18:16:44 +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 "gawk".

The branch, master has been updated
       via  7a7d021de54fbb1561367b1155bc1320a21d003d (commit)
      from  0dd8054d05d8286f2f7cbcf85456c6953a9b6146 (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.sv.gnu.org/cgit/gawk.git/commit/?id=7a7d021de54fbb1561367b1155bc1320a21d003d

commit 7a7d021de54fbb1561367b1155bc1320a21d003d
Author: Arnold D. Robbins <address@hidden>
Date:   Sun Dec 11 20:16:33 2016 +0200

    Update dfa.

diff --git a/ChangeLog b/ChangeLog
index b3f3363..c620533 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2016-12-11         Arnold D. Robbins     <address@hidden>
+
+       * dfa.c: Sync with GNULIB.
+
 2016-11-30         Arnold D. Robbins     <address@hidden>
 
        * dfa.c: Sync with fixes in GNULIB.
diff --git a/dfa.c b/dfa.c
index ae64ba9..10a8358 100644
--- a/dfa.c
+++ b/dfa.c
@@ -2850,39 +2850,33 @@ realloc_trans_if_necessary (struct dfa *d, state_num 
new_state)
 static state_num
 build_state (state_num s, struct dfa *d, unsigned char uc)
 {
-  state_num *trans;             /* The new transition table.  */
-  state_num i, maxstate;
+  /* A pointer to the new transition table, and the table itself.  */
+  state_num **ptrans = (ACCEPTING (s, *d) ? d->fails : d->trans) + s;
+  state_num *trans = *ptrans;
 
-  if (d->fails[s] != NULL)
-    trans = d->fails[s];
-  else
+  if (!trans)
     {
-      state_num **ptrans = (ACCEPTING (s, *d) ? d->fails : d->trans) + s;
-      if (!*ptrans)
+      /* MAX_TRCOUNT is an arbitrary upper limit on the number of
+         transition tables that can exist at once, other than for
+         initial states.  Often-used transition tables are quickly
+         rebuilt, whereas rarely-used ones are cleared away.  */
+      if (MAX_TRCOUNT <= d->trcount)
         {
-          /* MAX_TRCOUNT is an arbitrary upper limit on the number of
-             transition tables that can exist at once, other than for
-             initial states.  Often-used transition tables are quickly
-             rebuilt, whereas rarely-used ones are cleared away.  */
-          if (MAX_TRCOUNT <= d->trcount)
+          for (state_num i = d->min_trcount; i < d->tralloc; i++)
             {
-              for (i = d->min_trcount; i < d->tralloc; i++)
-                {
-                  free (d->trans[i]);
-                  free (d->fails[i]);
-                  d->trans[i] = d->fails[i] = NULL;
-                }
-              d->trcount = 0;
+              free (d->trans[i]);
+              free (d->fails[i]);
+              d->trans[i] = d->fails[i] = NULL;
             }
-
-          d->trcount++;
-          *ptrans = xmalloc (NOTCHAR * sizeof *trans);
+          d->trcount = 0;
         }
-      trans = *ptrans;
+
+      d->trcount++;
+      *ptrans = trans = xmalloc (NOTCHAR * sizeof *trans);
 
       /* Fill transition table with a default value which means that the
          transited state has not been calculated yet.  */
-      for (i = 0; i < NOTCHAR; i++)
+      for (int i = 0; i < NOTCHAR; i++)
         trans[i] = -2;
     }
 
@@ -2900,8 +2894,8 @@ build_state (state_num s, struct dfa *d, unsigned char uc)
   /* Now go through the new transition table, and make sure that the trans
      and fail arrays are allocated large enough to hold a pointer for the
      largest state mentioned in the table.  */
-  maxstate = -1;
-  for (i = 0; i < NOTCHAR; ++i)
+  state_num maxstate = -1;
+  for (int i = 0; i < NOTCHAR; i++)
     if (maxstate < trans[i])
       maxstate = trans[i];
   realloc_trans_if_necessary (d, maxstate);

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

Summary of changes:
 ChangeLog |    4 ++++
 dfa.c     |   46 ++++++++++++++++++++--------------------------
 2 files changed, 24 insertions(+), 26 deletions(-)


hooks/post-receive
-- 
gawk



reply via email to

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