@@ -409,11 +409,9 @@ static cmark_node *finalize(cmark_parser *parser, cmark_node *b) {
409
409
// in parser. (Used to check that the counts in parser, which are updated incrementally, are
410
410
// correct.)
411
411
bool check_open_block_counts (cmark_parser * parser ) {
412
- cmark_parser tmp_parser = {0 }; // Only used for its open_block_counts and total_open_blocks fields .
412
+ cmark_parser tmp_parser = {0 }; // Only used for its open_block_counts field .
413
413
add_open_block_counts (& tmp_parser , parser -> root );
414
- return
415
- tmp_parser .total_open_blocks == parser -> total_open_blocks &&
416
- memcmp (tmp_parser .open_block_counts , parser -> open_block_counts , sizeof (parser -> open_block_counts )) == 0 ;
414
+ return memcmp (tmp_parser .open_block_counts , parser -> open_block_counts , sizeof (parser -> open_block_counts )) == 0 ;
417
415
}
418
416
419
417
// Add a node as child of another. Return pointer to child.
@@ -1084,14 +1082,10 @@ static cmark_node *check_open_blocks(cmark_parser *parser, cmark_chunk *input,
1084
1082
* all_matched = false;
1085
1083
cmark_node * container = parser -> root ;
1086
1084
cmark_node_type cont_type ;
1087
- cmark_parser tmp_parser ; // Only used for its open_block_counts and total_open_blocks fields.
1088
- memcpy (tmp_parser .open_block_counts , parser -> open_block_counts , sizeof (parser -> open_block_counts ));
1089
- tmp_parser .total_open_blocks = parser -> total_open_blocks ;
1090
1085
1091
1086
assert (check_open_block_counts (parser ));
1092
1087
1093
1088
while (S_last_child_is_open (container )) {
1094
- decr_open_block_count (& tmp_parser , S_type (container ));
1095
1089
container = container -> last_child ;
1096
1090
cont_type = S_type (container );
1097
1091
@@ -1103,26 +1097,6 @@ static cmark_node *check_open_blocks(cmark_parser *parser, cmark_chunk *input,
1103
1097
continue ;
1104
1098
}
1105
1099
1106
- if (parser -> blank ) {
1107
- const size_t n_list = read_open_block_count (& tmp_parser , CMARK_NODE_LIST );
1108
- const size_t n_item = read_open_block_count (& tmp_parser , CMARK_NODE_ITEM );
1109
- const size_t n_para = read_open_block_count (& tmp_parser , CMARK_NODE_PARAGRAPH );
1110
- if (n_list + n_item + n_para == tmp_parser .total_open_blocks ) {
1111
- if (parser -> current -> flags & CMARK_NODE__OPEN_BLOCK ) {
1112
- if (S_type (parser -> current ) == CMARK_NODE_PARAGRAPH ) {
1113
- container = parser -> current ;
1114
- goto done ;
1115
- }
1116
- if (S_type (parser -> current ) == CMARK_NODE_ITEM ) {
1117
- if (parser -> current -> flags & CMARK_NODE__OPEN ) {
1118
- container = parser -> current ;
1119
- cont_type = S_type (container );
1120
- }
1121
- }
1122
- }
1123
- }
1124
- }
1125
-
1126
1100
switch (cont_type ) {
1127
1101
case CMARK_NODE_BLOCK_QUOTE :
1128
1102
if (!parse_block_quote_prefix (parser , input ))
@@ -1413,7 +1387,7 @@ static void add_text_to_container(cmark_parser *parser, cmark_node *container,
1413
1387
S_set_last_line_blank (container , last_line_blank );
1414
1388
1415
1389
tmp = container ;
1416
- while (tmp -> parent && S_last_line_blank ( tmp -> parent ) ) {
1390
+ while (tmp -> parent ) {
1417
1391
S_set_last_line_blank (tmp -> parent , false);
1418
1392
tmp = tmp -> parent ;
1419
1393
}
0 commit comments