summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2022-12-18 20:04:44 -0800
committerPaul Eggert <eggert@cs.ucla.edu>2022-12-19 12:33:57 -0800
commitfc0655d78220ed5533b3e34c52c8fc1fc9719061 (patch)
treeca783936001d3a6d96bbb166104918909316f866
parent3ac95905f430b2549a69cd7c95c278dc626de12f (diff)
downloadsed-fc0655d78220ed5533b3e34c52c8fc1fc9719061.tar.gz
sed: simplify by aborting rather than asserting
* 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.
-rw-r--r--sed/debug.c13
1 files 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 ();
}
}