summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2016-02-09 23:44:10 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2016-02-09 23:44:10 -0800
commitb73bcedabb2ca6f06b2e96c410a603416ce17029 (patch)
tree2f6fb47c70e64e3d01430819ba0c69b6a1e597be /src
parent4d2d486333c358eb3adf3d0649163e319a3b8b69 (diff)
Factored out contains_inlines.
Diffstat (limited to 'src')
-rw-r--r--src/blocks.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/blocks.c b/src/blocks.c
index 2630db4..c4593bf 100644
--- 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);
}
}