| 775 | } |
| 776 | |
| 777 | int cmark_node_prepend_child(cmark_node *node, cmark_node *child) { |
| 778 | if (!S_can_contain(node, child)) { |
| 779 | return 0; |
| 780 | } |
| 781 | |
| 782 | S_node_unlink(child); |
| 783 | |
| 784 | cmark_node *old_first_child = node->first_child; |
| 785 | |
| 786 | child->next = old_first_child; |
| 787 | child->prev = NULL; |
| 788 | child->parent = node; |
| 789 | node->first_child = child; |
| 790 | |
| 791 | if (old_first_child) { |
| 792 | old_first_child->prev = child; |
| 793 | } else { |
| 794 | // Also set last_child if node previously had no children. |
| 795 | node->last_child = child; |
| 796 | } |
| 797 | |
| 798 | return 1; |
| 799 | } |
| 800 | |
| 801 | int cmark_node_append_child(cmark_node *node, cmark_node *child) { |
| 802 | if (!S_can_contain(node, child)) { |
no test coverage detected