diff options
author | Nick Wellnhofer <wellnhofer@aevum.de> | 2014-11-20 13:02:53 +0100 |
---|---|---|
committer | Nick Wellnhofer <wellnhofer@aevum.de> | 2014-11-22 16:08:32 +0100 |
commit | 759e03748a368be8b209dfd113441c05e1a5dcc0 (patch) | |
tree | 34147fb5ac44a69c1523f79d9346d4f76cb59802 /src/node.c | |
parent | cf1c490c7a3fd3f9681e97f1e662735e1509250c (diff) |
More tree hierarchy checks and tests
Diffstat (limited to 'src/node.c')
-rw-r--r-- | src/node.c | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -348,6 +348,17 @@ S_is_inline(cmark_node *node) { static bool S_can_contain(cmark_node *node, cmark_node *child) { + cmark_node *cur; + + // Verify that child is not an ancestor of node or equal to node. + cur = node; + do { + if (cur == child) { + return false; + } + cur = cur->parent; + } while (cur != NULL); + if (child->type == CMARK_NODE_DOCUMENT) { return false; } |