Skip to content

Commit fb9375b

Browse files
committed
Remove CMARK_NODE__LAST_LINE_CHECKED flag
This flag was introduced by #284, but we will not need it once we update `S_ends_with_blank_line` to not use resursion in the next commit.
1 parent 2885a95 commit fb9375b

File tree

2 files changed

+2
-15
lines changed

2 files changed

+2
-15
lines changed

src/blocks.c

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,6 @@ static bool S_last_line_blank(const cmark_node *node) {
3636
return (node->flags & CMARK_NODE__LAST_LINE_BLANK) != 0;
3737
}
3838

39-
static bool S_last_line_checked(const cmark_node *node) {
40-
return (node->flags & CMARK_NODE__LAST_LINE_CHECKED) != 0;
41-
}
42-
4339
static CMARK_INLINE cmark_node_type S_type(const cmark_node *node) {
4440
return (cmark_node_type)node->type;
4541
}
@@ -51,10 +47,6 @@ static void S_set_last_line_blank(cmark_node *node, bool is_blank) {
5147
node->flags &= ~CMARK_NODE__LAST_LINE_BLANK;
5248
}
5349

54-
static void S_set_last_line_checked(cmark_node *node) {
55-
node->flags |= CMARK_NODE__LAST_LINE_CHECKED;
56-
}
57-
5850
static CMARK_INLINE bool S_is_line_end_char(char c) {
5951
return (c == '\n' || c == '\r');
6052
}
@@ -231,14 +223,10 @@ static void remove_trailing_blank_lines(cmark_strbuf *ln) {
231223
// Check to see if a node ends with a blank line, descending
232224
// if needed into lists and sublists.
233225
static bool S_ends_with_blank_line(cmark_node *node) {
234-
if (S_last_line_checked(node)) {
235-
return(S_last_line_blank(node));
236-
} else if ((S_type(node) == CMARK_NODE_LIST ||
237-
S_type(node) == CMARK_NODE_ITEM) && node->last_child) {
238-
S_set_last_line_checked(node);
226+
if ((S_type(node) == CMARK_NODE_LIST ||
227+
S_type(node) == CMARK_NODE_ITEM) && node->last_child) {
239228
return(S_ends_with_blank_line(node->last_child));
240229
} else {
241-
S_set_last_line_checked(node);
242230
return (S_last_line_blank(node));
243231
}
244232
}

src/node.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ typedef struct {
4949
enum cmark_node__internal_flags {
5050
CMARK_NODE__OPEN = (1 << 0),
5151
CMARK_NODE__LAST_LINE_BLANK = (1 << 1),
52-
CMARK_NODE__LAST_LINE_CHECKED = (1 << 2),
5352
};
5453

5554
struct cmark_node {

0 commit comments

Comments
 (0)