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

Function S_node_unlink

src/node.c:671–693  ·  view source on GitHub ↗

Unlink a node without adjusting its next, prev, and parent pointers.

Source from the content-addressed store, hash-verified

669
670// Unlink a node without adjusting its next, prev, and parent pointers.
671static void S_node_unlink(cmark_node *node) {
672 if (node == NULL) {
673 return;
674 }
675
676 if (node->prev) {
677 node->prev->next = node->next;
678 }
679 if (node->next) {
680 node->next->prev = node->prev;
681 }
682
683 // Adjust first_child and last_child of parent.
684 cmark_node *parent = node->parent;
685 if (parent) {
686 if (parent->first_child == node) {
687 parent->first_child = node->next;
688 }
689 if (parent->last_child == node) {
690 parent->last_child = node->prev;
691 }
692 }
693}
694
695void cmark_node_unlink(cmark_node *node) {
696 S_node_unlink(node);

Callers 6

cmark_node_freeFunction · 0.85
cmark_node_unlinkFunction · 0.85
cmark_node_insert_beforeFunction · 0.85
cmark_node_insert_afterFunction · 0.85
cmark_node_prepend_childFunction · 0.85
cmark_node_append_childFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected