cmark

My personal build of CMark ✏️

Commit
b73bcedabb2ca6f06b2e96c410a603416ce17029
Parent
4d2d486333c358eb3adf3d0649163e319a3b8b69
Author
John MacFarlane <jgm@berkeley.edu>
Date

Factored out contains_inlines.

Diffstat

1 file changed, 6 insertions, 2 deletions

Status File Name N° Changes Insertions Deletions
Modified src/blocks.c 8 6 2
diff --git a/src/blocks.c b/src/blocks.c
@@ -133,6 +133,11 @@ static inline bool accepts_lines(cmark_node_type block_type) {
           block_type == CMARK_NODE_CODE_BLOCK);
 }
 
+static inline bool contains_inlines(cmark_node_type block_type) {
+  return (block_type == CMARK_NODE_PARAGRAPH ||
+          block_type == CMARK_NODE_HEADING);
+}
+
 static void add_line(cmark_node *node, cmark_chunk *ch, cmark_parser *parser) {
   int chars_to_tab;
   int i;
@@ -357,8 +362,7 @@ static void process_inlines(cmark_node *root, cmark_reference_map *refmap,
   while ((ev_type = cmark_iter_next(iter)) != CMARK_EVENT_DONE) {
     cur = cmark_iter_get_node(iter);
     if (ev_type == CMARK_EVENT_ENTER) {
-      if (cur->type == CMARK_NODE_PARAGRAPH ||
-          cur->type == CMARK_NODE_HEADING) {
+      if (contains_inlines(cur->type)) {
         cmark_parse_inlines(cur, refmap, options);
       }
     }