Subject: bug#17027: [PATCH] grep: prefer regex to DFA for ANYCHAR in non-UTF8 locales

From: Paul Eggert <[email-masked]>
Date: Tue, 08 Apr 2014 13:19:03 -0700

Aharon Robbins privately pointed out that the bool_bf business wasn't 
worth the hassle, so I installed the attached patch to simplify.  
Thanks, Aharon!

>From 4a1040bd62bfcb916b81900cad30bc4bd3c956c3 Mon Sep 17 00:00:00 2001
From: Paul Eggert <[email-masked]>
Date: Tue, 8 Apr 2014 13:15:24 -0700
Subject: [PATCH] grep: remove bool_bf

The extra complexity of this microoptimization wasn't ever much help,
and currently it generated bigger code with gcc -O2 (x86-64).
* src/dfa.c (bool_bf): Remove.  All uses replaced by plain 'bool',
without a bitfield.
---
 src/dfa.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/src/dfa.c b/src/dfa.c
index 34f230e..a3cfa8d 100644
--- a/src/dfa.c
+++ b/src/dfa.c
@@ -34,13 +34,6 @@
 #include <locale.h>
 #include <stdbool.h>
 
-/* The pre-C99 <stdbool.h> emulation doesn't work for bool bitfields.  */
-#if __STDC_VERSION__ < 199901
-typedef unsigned int bool_bf;
-#else
-typedef bool bool_bf;
-#endif
-
 #define STREQ(a, b) (strcmp (a, b) == 0)
 
 /* ISASCIIDIGIT differs from isdigit, as follows:
@@ -291,8 +284,8 @@ typedef struct
   size_t hash;                  /* Hash of the positions of this state.  */
   position_set elems;           /* Positions this state could match.  */
   unsigned char context;        /* Context from previous state.  */
-  bool_bf has_backref : 1;      /* True if this state matches a \<digit>.  */
-  bool_bf has_mbcset : 1;       /* True if this state matches a MBCSET.  */
+  bool has_backref;             /* True if this state matches a \<digit>.  */
+  bool has_mbcset;              /* True if this state matches a MBCSET.  */
   unsigned short constraint;    /* Constraint for this state to accept.  */
   token first_end;              /* Token value of the first END in elems.  */
   position_set mbps;            /* Positions which can match multibyte
-- 
1.9.0