blob: 8ccf18497af4a143915820aedffc4191e0a1ccd7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
#include <stdbool.h>
#include <stdio.h>
#include "buffer.h"
#include "ast.h"
#include "inlines.h"
#include "references.h"
// Free a node_block list and any children.
void cmark_free_blocks(node_block *e)
{
node_block * next;
while (e != NULL) {
free_inlines(e->inline_content);
strbuf_free(&e->string_content);
if (e->tag == BLOCK_FENCED_CODE) {
strbuf_free(&e->as.code.info);
} else if (e->tag == BLOCK_DOCUMENT) {
reference_map_free(e->as.document.refmap);
}
if (e->last_child) {
// Splice children into list
e->last_child->next = e->next;
e->next = e->children;
}
next = e->next;
free(e);
e = next;
}
}
|