MCPcopy Create free account
hub / github.com/commonmark/cmark / cmark_node_append_child

Function cmark_node_append_child

src/node.c:801–823  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

799}
800
801int cmark_node_append_child(cmark_node *node, cmark_node *child) {
802 if (!S_can_contain(node, child)) {
803 return 0;
804 }
805
806 S_node_unlink(child);
807
808 cmark_node *old_last_child = node->last_child;
809
810 child->next = NULL;
811 child->prev = old_last_child;
812 child->parent = node;
813 node->last_child = child;
814
815 if (old_last_child) {
816 old_last_child->next = child;
817 } else {
818 // Also set first_child if node previously had no children.
819 node->first_child = child;
820 }
821
822 return 1;
823}
824
825static void S_print_error(FILE *out, cmark_node *node, const char *elem) {
826 if (out == NULL) {

Callers 5

create_treeFunction · 0.85
custom_nodesFunction · 0.85
hierarchyFunction · 0.85
test_contentFunction · 0.85
sub_documentFunction · 0.85

Calls 2

S_can_containFunction · 0.85
S_node_unlinkFunction · 0.85

Tested by 1

test_contentFunction · 0.68