From 559dd197da0799b17280391fac9dcf427f281758 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sat, 6 Feb 2016 22:22:21 -0800 Subject: Use an assertion to check for in-range html_block_type. It's a programming error if the type is out of range. --- src/blocks.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'src/blocks.c') 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; -- cgit v1.2.3