grep-commit
[Top][All Lists]
Advanced

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

grep branch, master, updated. v2.6.3-40-g2936f50


From: Jim Meyering
Subject: grep branch, master, updated. v2.6.3-40-g2936f50
Date: Thu, 08 Apr 2010 21:17:22 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "grep".

The branch, master has been updated
       via  2936f502f84e238070f5f459f2c52395ddfde158 (commit)
      from  fe2064088e5d45f621a79ea197c0eb17dceed940 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/grep.git/commit/?id=2936f502f84e238070f5f459f2c52395ddfde158


commit 2936f502f84e238070f5f459f2c52395ddfde158
Author: Jim Meyering <address@hidden>
Date:   Thu Apr 8 10:08:37 2010 +0200

    dfa: convert "cannot happen" code/comment to use assert
    
    * src/dfa.c (dfamust): There were numerous "cannot happen" comments,
    some associated with "if (expr) goto done;".  Replace each with an
    equivalent "assert (!expr);".

diff --git a/src/dfa.c b/src/dfa.c
index ec015d6..f3f8c60 100644
--- a/src/dfa.c
+++ b/src/dfa.c
@@ -3722,7 +3722,7 @@ dfamust (struct dfa *d)
         {
         case LPAREN:
         case RPAREN:
-          goto done;           /* "cannot happen" */
+          assert (!"neither LPAREN nor RPAREN may appear here");
         case EMPTY:
         case BEGLINE:
         case ENDLINE:
@@ -3735,15 +3735,13 @@ dfamust (struct dfa *d)
           break;
         case STAR:
         case QMARK:
-          if (mp <= musts)
-            goto done;         /* "cannot happen" */
+          assert (musts < mp);
           --mp;
           resetmust(mp);
           break;
         case OR:
         case ORTOP:
-          if (mp < &musts[2])
-            goto done;         /* "cannot happen" */
+          assert (&musts[2] <= mp);
           {
             char **new;
             must *lmp;
@@ -3781,14 +3779,12 @@ dfamust (struct dfa *d)
           }
           break;
         case PLUS:
-          if (mp <= musts)
-            goto done;         /* "cannot happen" */
+          assert (musts < mp);
           --mp;
           mp->is[0] = '\0';
           break;
         case END:
-          if (mp != &musts[1])
-            goto done;         /* "cannot happen" */
+          assert (mp == &musts[1]);
           for (i = 0; musts[0].in[i] != NULL; ++i)
             if (strlen(musts[0].in[i]) > strlen(result))
               result = musts[0].in[i];
@@ -3796,8 +3792,7 @@ dfamust (struct dfa *d)
             exact = 1;
           goto done;
         case CAT:
-          if (mp < &musts[2])
-            goto done;         /* "cannot happen" */
+          assert (&musts[2] <= mp);
           {
             must *lmp;
             must *rmp;
@@ -3855,8 +3850,7 @@ dfamust (struct dfa *d)
         default:
           if (t < END)
             {
-              /* "cannot happen" */
-              goto done;
+              assert (!"oops! t >= END");
             }
           else if (t == '\0')
             {

-----------------------------------------------------------------------

Summary of changes:
 src/dfa.c |   20 +++++++-------------
 1 files changed, 7 insertions(+), 13 deletions(-)


hooks/post-receive
-- 
grep




reply via email to

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