summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2016-02-06 22:22:21 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2016-02-06 22:22:21 -0800
commit559dd197da0799b17280391fac9dcf427f281758 (patch)
treef115e3c0199ccc1e6a6468d82c8fd8a854857795
parent46602f4fdddd56e9d9869062e87184dd6b269fa8 (diff)
Use an assertion to check for in-range html_block_type.
It's a programming error if the type is out of range.
-rw-r--r--src/blocks.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/blocks.c b/src/blocks.c
index 5554a17..d75bb67 100644
--- a/src/blocks.c
+++ b/src/blocks.c
@@ -712,8 +712,10 @@ static bool S_parse_html_block(cmark_parser *parser,
cmark_node *container)
{
bool res = false;
+ int html_block_type = container->as.html_block_type;
- switch (container->as.html_block_type) {
+ assert(html_block_type >= 1 && html_block_type <= 7);
+ switch (html_block_type) {
case 1:
case 2:
case 3:
@@ -726,11 +728,6 @@ static bool S_parse_html_block(cmark_parser *parser,
case 7:
res = !parser->blank;
break;
- default:
- fprintf(stderr, "Error (%s:%d): Unknown HTML block type %d\n", __FILE__,
- __LINE__, container->as.html_block_type);
- /* FIXME that's really not something a library should do .. */
- exit(1);
}
return res;