Subject: bug#17605: closed (Re: bug#17605: [PATCH] dfa: simplify building intial state)

From: [email-masked] (GNU bug Tracking System)
Date: Tue, 27 May 2014 00:57:04 +0000

Your bug report

#17605: [PATCH] dfa: simplify building intial state

which was filed against the grep package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
17605: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=17605
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#17605: [PATCH] dfa: simplify building intial state
From: Paul Eggert <[email-masked]>
To: Norihiro Tanaka <[email-masked]>
Cc: [email-masked], [email-masked]
Date: Mon, 26 May 2014 17:55:50 -0700
List-Id: <debbugs-submit.debbugs.gnu.org>

Thanks, I've pushed those changes, along with the changes for Bug#17604.

Subject: [PATCH] dfa: simplify building intial state
From: Norihiro Tanaka <[email-masked]>
To: [email-masked]
Date: Tue, 27 May 2014 08:58:48 +0900
List-Id: <debbugs-submit.debbugs.gnu.org>

I see that initialization isn't needed in build_state_zero().  So remove
it and simplify.
From 6eb06035f4acd7adf6d3fe166471740bd633f6dd Mon Sep 17 00:00:00 2001
From: Norihiro Tanaka <[email-masked]>
Date: Sat, 24 May 2014 09:26:31 +0900
Subject: [PATCH] dfa: simplify building intial state

Initialization of members of struct dfa isn't needed in
build_state_zero().  So remove them, and simplify.

* src/dfa.c (build_state_zero): Remove it.
(dfaexec): Call realloc_trans_if_necessary and build_state directly.
---
 src/dfa.c | 21 ++++-----------------
 1 file changed, 4 insertions(+), 17 deletions(-)

diff --git a/src/dfa.c b/src/dfa.c
index 70dc046..c25322d 100644
--- a/src/dfa.c
+++ b/src/dfa.c
@@ -2896,22 +2896,6 @@ build_state (state_num s, struct dfa *d)
     d->trans[s] = trans;
 }
 
-static void
-build_state_zero (struct dfa *d)
-{
-  /* Initial size of the transition tables; must be positive.  */
-  int initial_tab_size = 1;
-
-  d->tralloc = 0;
-  d->trcount = 0;
-  d->trans = NULL;
-  d->fails = NULL;
-  d->success = NULL;
-  d->newlines = NULL;
-  realloc_trans_if_necessary (d, initial_tab_size);
-  build_state (0, d);
-}
-
 /* Multibyte character handling sub-routines for dfaexec.  */
 
 /* Return values of transit_state_singlebyte, and
@@ -3275,7 +3259,10 @@ dfaexec (struct dfa *d, char const *begin, char *end,
   size_t nlcount = 0;
 
   if (!d->tralloc)
-    build_state_zero (d);
+    {
+      realloc_trans_if_necessary (d, 0);
+      build_state (0, d);
+    }
 
   s = s1 = 0;
   p = mbp = (unsigned char const *) begin;
-- 
1.9.3