summaryrefslogtreecommitdiff
path: root/src/node.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/node.c')
-rw-r--r--src/node.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/node.c b/src/node.c
index c6c2902..147debf 100644
--- a/src/node.c
+++ b/src/node.c
@@ -249,6 +249,26 @@ cmark_node *cmark_node_last_child(cmark_node *node) {
}
}
+static bufsize_t cmark_set_cstr(cmark_mem *mem, unsigned char **dst,
+ const char *src) {
+ unsigned char *old = *dst;
+ bufsize_t len;
+
+ if (src && src[0]) {
+ len = (bufsize_t)strlen(src);
+ *dst = (unsigned char *)mem->realloc(NULL, len + 1);
+ memcpy(*dst, src, len + 1);
+ } else {
+ len = 0;
+ *dst = NULL;
+ }
+ if (old) {
+ mem->free(old);
+ }
+
+ return len;
+}
+
void *cmark_node_get_user_data(cmark_node *node) {
if (node == NULL) {
return NULL;