From f3f50b29d615d2678d8047dc277b108cc5143167 Mon Sep 17 00:00:00 2001 From: Nick Wellnhofer Date: Sun, 19 Jan 2020 13:46:10 +0100 Subject: Rearrange struct cmark_node Introduce multi-purpose data/len members in struct cmark_node. This is mainly used to store literal text for inlines, code and HTML blocks. Move the content strbuf for blocks from cmark_node to cmark_parser. When finalizing nodes that allow inlines (paragraphs and headings), detach the strbuf and store the block content in the node's data/len members. Free the block content after processing inlines. Reduces size of struct cmark_node by 8 bytes. --- src/commonmark.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/commonmark.c') diff --git a/src/commonmark.c b/src/commonmark.c index 41bfa52..cc12bb4 100644 --- a/src/commonmark.c +++ b/src/commonmark.c @@ -146,7 +146,7 @@ static bool is_autolink(cmark_node *node) { if (strcmp((const char *)url, "mailto:") == 0) { url += 7; } - return strcmp((const char *)url, (char *)link_text->as.literal.data) == 0; + return strcmp((const char *)url, (char *)link_text->data) == 0; } // if node is a block node, returns node. -- cgit v1.2.3