Subject: Re: bug#24159: [PATCH] dfa: minor fix for whether dfa is fast or not

From: Jim Meyering <[email-masked]>
Date: Fri, 5 Aug 2016 13:29:43 -0700

On Fri, Aug 5, 2016 at 4:30 AM, Norihiro Tanaka <[email-masked]> wrote:
> dfaoptimize() is not set fast flag even if it is success, but it is wrong.
> If success, dfa matcher uses algorithm for single byte, and it is so fast.
>
> I think this bug does not affect for grep, but it will affect with the
> patch that I just sent to gawk.

Thank you for the patch.
I was going to push it with the attached slightly updated log message.
Note however that grep does use that -> fast member via dfasearch.c's
use of the dfaisfast function.
But then I realized I should at least verify with "make check", and
found that this makes grep's dfa-match test fail.
Thus, I will not be pushing it as-is.
From 61e0661e1b086c8933197f498139db26f157b713 Mon Sep 17 00:00:00 2001
From: Norihiro Tanaka <[email-masked]>
Date: Fri, 5 Aug 2016 20:15:24 +0900
Subject: [PATCH] dfa: minor fix for whether dfa is "fast"

* src/dfa.c (dfaoptimize): When a UTF-8 optimization succeeds for
a DFA (it can use single-byte code paths), record that by setting
its ->fast flag.
---
 src/dfa.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/dfa.c b/src/dfa.c
index 596cc13..55d741c 100644
--- a/src/dfa.c
+++ b/src/dfa.c
@@ -3365,6 +3365,7 @@ dfaoptimize (struct dfa *d)
   free_mbdata (d);
   d->multibyte = false;
   d->dfaexec = dfaexec_sb;
+  d->fast = true;
 }

 static void
-- 
2.8.0-rc2