sed-devel
[Top][All Lists]
Advanced

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

[INSTALLED 3/4] sed: simplify by aborting rather than asserting


From: Paul Eggert
Subject: [INSTALLED 3/4] sed: simplify by aborting rather than asserting
Date: Mon, 19 Dec 2022 12:49:00 -0800

* sed/debug.c: Do not include assert.h.
(debug_print_function): Use plain abort () rather than assert (0).
This is simpler and just as useful.
---
 sed/debug.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/sed/debug.c b/sed/debug.c
index 25c054d..24d6d95 100644
--- a/sed/debug.c
+++ b/sed/debug.c
@@ -25,7 +25,6 @@
 #include <string.h>
 #include <stdlib.h>
 #include <sys/types.h>
-#include <assert.h>
 
 /* indentation level when printing the program */
 static int block_level = 0;
@@ -286,9 +285,9 @@ debug_print_function (const struct vector *program, const 
struct sed_cmd *sc)
     case '}':
       break;
 
-    case '#':                  /* LCOV_EXCL_LINE */
+    case '#':
       /* should not happen - discarded during compilation.  */
-      assert (0);               /* LCOV_EXCL_LINE */
+      abort ();
 
     case 'a':
     case 'c':
@@ -377,9 +376,9 @@ debug_print_function (const struct vector *program, const 
struct sed_cmd *sc)
 
       /* 't','T' are lumped above with 'b' */
 
-    case 'v':                  /* LCOV_EXCL_LINE */
+    case 'v':
       /* should not happen - handled during compilation then discarded. */
-      assert (0);               /* LCOV_EXCL_LINE */
+      abort ();
 
     case 'W':
       debug_print_output_file (sc->x.outf);
@@ -399,9 +398,9 @@ debug_print_function (const struct vector *program, const 
struct sed_cmd *sc)
     case 'z':
       break;
 
-    default:                   /* LCOV_EXCL_LINE */
+    default:
       /* should not happen - unless missed a sed command. */
-      assert (0);               /* LCOV_EXCL_LINE */
+      abort ();
     }
 }
 
-- 
2.38.1




reply via email to

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