summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cmark.h3
-rw-r--r--src/node.c2
2 files changed, 3 insertions, 2 deletions
diff --git a/src/cmark.h b/src/cmark.h
index dcd7e2c..4fa92ca 100644
--- a/src/cmark.h
+++ b/src/cmark.h
@@ -387,7 +387,8 @@ CMARK_EXPORT int cmark_node_insert_before(cmark_node *node,
*/
CMARK_EXPORT int cmark_node_insert_after(cmark_node *node, cmark_node *sibling);
-/** Replaces 'oldnode' with 'newnode' and frees the memory used by 'oldnode'.
+/** Replaces 'oldnode' with 'newnode' and unlinks 'oldnode' (but does
+ * not free its memory).
* Returns 1 on success, 0 on failure.
*/
CMARK_EXPORT int cmark_node_replace(cmark_node *oldnode, cmark_node *newnode);
diff --git a/src/node.c b/src/node.c
index ee1d6c3..26a8e25 100644
--- a/src/node.c
+++ b/src/node.c
@@ -734,7 +734,7 @@ int cmark_node_replace(cmark_node *oldnode, cmark_node *newnode) {
if (!cmark_node_insert_before(oldnode, newnode)) {
return 0;
}
- cmark_node_free(oldnode); // free calls cmark_node_unlink
+ cmark_node_unlink(oldnode);
return 1;
}