diff options
author | Nick Wellnhofer <wellnhofer@aevum.de> | 2020-01-18 23:37:32 +0100 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2020-01-23 08:25:54 -0800 |
commit | 75b48c5938f5984dbcf79a579d15c9cbd6447d12 (patch) | |
tree | 7c97c1d4fbcb6b7230e1d4893a2c3eff766fe0bc /src/node.c | |
parent | b237924585e61532ada774bf9e70eadff00666dc (diff) |
Use C string instead of chunk for custom block contents
Reduces size of struct cmark_node by 8 bytes.
Diffstat (limited to 'src/node.c')
-rw-r--r-- | src/node.c | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -125,8 +125,8 @@ static void S_free_nodes(cmark_node *e) { break; case CMARK_NODE_CUSTOM_BLOCK: case CMARK_NODE_CUSTOM_INLINE: - cmark_chunk_free(NODE_MEM(e), &e->as.custom.on_enter); - cmark_chunk_free(NODE_MEM(e), &e->as.custom.on_exit); + NODE_MEM(e)->free(e->as.custom.on_enter); + NODE_MEM(e)->free(e->as.custom.on_exit); break; default: break; @@ -571,7 +571,7 @@ const char *cmark_node_get_on_enter(cmark_node *node) { switch (node->type) { case CMARK_NODE_CUSTOM_INLINE: case CMARK_NODE_CUSTOM_BLOCK: - return cmark_chunk_to_cstr(NODE_MEM(node), &node->as.custom.on_enter); + return node->as.custom.on_enter ? (char *)node->as.custom.on_enter : ""; default: break; } @@ -587,7 +587,7 @@ int cmark_node_set_on_enter(cmark_node *node, const char *on_enter) { switch (node->type) { case CMARK_NODE_CUSTOM_INLINE: case CMARK_NODE_CUSTOM_BLOCK: - cmark_chunk_set_cstr(NODE_MEM(node), &node->as.custom.on_enter, on_enter); + cmark_set_cstr(NODE_MEM(node), &node->as.custom.on_enter, on_enter); return 1; default: break; @@ -604,7 +604,7 @@ const char *cmark_node_get_on_exit(cmark_node *node) { switch (node->type) { case CMARK_NODE_CUSTOM_INLINE: case CMARK_NODE_CUSTOM_BLOCK: - return cmark_chunk_to_cstr(NODE_MEM(node), &node->as.custom.on_exit); + return node->as.custom.on_exit ? (char *)node->as.custom.on_exit : ""; default: break; } @@ -620,7 +620,7 @@ int cmark_node_set_on_exit(cmark_node *node, const char *on_exit) { switch (node->type) { case CMARK_NODE_CUSTOM_INLINE: case CMARK_NODE_CUSTOM_BLOCK: - cmark_chunk_set_cstr(NODE_MEM(node), &node->as.custom.on_exit, on_exit); + cmark_set_cstr(NODE_MEM(node), &node->as.custom.on_exit, on_exit); return 1; default: break; |