cmark

My personal build of CMark ✏️

Commit
8403ff2798a60a7d9df73a1129a5bc125c378a36
Parent
b56b8cbe99222ce5e1ab0d144a95cb697b93761d
Author
John MacFarlane <jgm@berkeley.edu>
Date

Improved free_inlines.

Diffstat

1 file changed, 9 insertions, 10 deletions

Status File Name N° Changes Insertions Deletions
Modified src/inlines.c 19 9 10
diff --git a/src/inlines.c b/src/inlines.c
@@ -124,17 +124,16 @@ inline static node_inl* make_simple(int t)
 // Utility function used by free_inlines
 void splice_into_list(node_inl* e, node_inl* children) {
 	node_inl * tmp;
-	tmp = children;
-	if (!tmp) {
-	    return ;
-	}
-	// Find last child
-	while (tmp->next) {
-	    tmp = tmp->next;
+	if (children) {
+	    tmp = children;
+	    // Find last child
+	    while (tmp->next) {
+		tmp = tmp->next;
+	    }
+	    // Splice children into list
+	    tmp->next = e->next;
+	    e->next = children;
 	}
-	// Splice children into list
-	tmp->next = e->next;
-	e->next = children;
 	return ;
 }