GNU bug report logs - #16581
suggested code simplification in dfa.c

Previous Next

Package: grep;

Reported by: Aharon Robbins <arnold <at> skeeve.com>

Date: Tue, 28 Jan 2014 20:12:01 UTC

Severity: normal

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#16581: closed (suggested code simplification in dfa.c)
Date: Sat, 08 Mar 2014 18:17:02 +0000
[Message part 1 (text/plain, inline)]
Your message dated Sat, 08 Mar 2014 10:16:45 -0800
with message-id <531B5E8D.1060701 <at> cs.ucla.edu>
and subject line Re:  suggested code simplification in dfa.c
has caused the debbugs.gnu.org bug report #16581,
regarding suggested code simplification in dfa.c
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
16581: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16581
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Aharon Robbins <arnold <at> skeeve.com>
To: bug-grep <at> gnu.org
Subject: suggested code simplification in dfa.c
Date: Tue, 28 Jan 2014 22:11:14 +0200
Hi.

The code in atom() looks to me like it could use a little refactoring
and simplification. I suggest the diff below. With it both grep and gawk
still pass their tests.

Thanks,

Arnold

diff --git a/src/dfa.c b/src/dfa.c
index b79c604..d2916ee 100644
--- a/src/dfa.c
+++ b/src/dfa.c
@@ -1725,17 +1725,20 @@ add_utf8_anychar (void)
 static void
 atom (void)
 {
-  if (0)
+  if (MBS_SUPPORT && tok == WCHAR)
     {
-      /* empty */
-    }
-  else if (MBS_SUPPORT && tok == WCHAR)
-    {
-      addtok_wc (case_fold ? towlower (wctok) : wctok);
-      if (case_fold && iswalpha (wctok))
+      if (! case_fold)
+        {
+          addtok_wc (wctok);
+        }
+      else
         {
-          addtok_wc (towupper (wctok));
-          addtok (OR);
+          addtok_wc (towlower (wctok));
+          if (iswalpha (wctok))
+   	  {
+                addtok_wc (towupper (wctok));
+                addtok (OR);
+   	  }
         }
 
       tok = lex ();


[Message part 3 (message/rfc822, inline)]
From: Paul Eggert <eggert <at> cs.ucla.edu>
To: 16581-done <at> debbugs.gnu.org
Subject: Re:  suggested code simplification in dfa.c
Date: Sat, 08 Mar 2014 10:16:45 -0800
This particular issue seems to have been put to bed in the savannah git 
master so I'm marking it as done.


This bug report was last modified 11 years and 78 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.