bug-grep
[Top][All Lists]
Advanced

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

Re: [PATCH 20/34] maint: dfa: convert #if-MBS_SUPPORT (dfastate)


From: Paolo Bonzini
Subject: Re: [PATCH 20/34] maint: dfa: convert #if-MBS_SUPPORT (dfastate)
Date: Thu, 15 Sep 2011 13:41:53 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:6.0.2) Gecko/20110906 Thunderbird/6.0.2

On 09/15/2011 12:28 PM, Jim Meyering wrote:
diff --git a/src/dfa.c b/src/dfa.c
index dd8259c..f245208 100644
--- a/src/dfa.c
+++ b/src/dfa.c
@@ -2578,11 +2578,9 @@ dfastate (int s, struct dfa *d, int trans[])

        /* If we are building a searching matcher, throw in the positions
           of state 0 as well. */
-#if MBS_SUPPORT
-      if (d->searchflag&&  (d->mb_cur_max == 1 || !next_isnt_1st_byte))
-#else
-      if (d->searchflag)
-#endif
+      if (d->searchflag
+          &&  (! MBS_SUPPORT
+              || (d->mb_cur_max == 1 || !next_isnt_1st_byte)))

No need for the inner parentheses around the ||.

Or change it to

   && !( MBS_SUPPORT && d->mb_cur_max > 1 && next_isnt_1st_byte)

Alternatively, in patch 30 (dfa: simplify several expressions) just change it to

   if (d->searchflags && !next_isnt_1st_byte)

since next_isnt_1st_byte is always zero for single-byte character sets. Bonus points for reversing its direction to next_is_1st_byte. :)

Paolo



reply via email to

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