cmark

My personal build of CMark ✏️

Commit
6c1f76a8a22f6c84231e5101f0950ce353ec8075
Parent
6f82e1cf327df8903384e4dc79e369a51b6b9eb8
Author
John MacFarlane <jgm@berkeley.edu>
Date

API change: Add cmark_node_set_type for completeness.

Diffstat

3 files changed, 20 insertions, 0 deletions

Status File Name N° Changes Insertions Deletions
Modified man/man3/cmark.3 4 4 0
Modified src/cmark.h 5 5 0
Modified src/node.c 11 11 0
diff --git a/man/man3/cmark.3 b/man/man3/cmark.3
@@ -135,6 +135,10 @@ typedef enum {
 
 .PP
 
+\fIint\fR \fBcmark_node_set_type\fR(\fIcmark_node *node\fR, \fIcmark_node_type node_type\fR)
+
+.PP
+
 \fIconst char*\fR \fBcmark_node_get_string_content\fR(\fIcmark_node *node\fR)
 
 .PP
diff --git a/src/cmark.h b/src/cmark.h
@@ -137,6 +137,11 @@ cmark_node_get_type(cmark_node *node);
 
 /**
  */
+CMARK_EXPORT int
+cmark_node_set_type(cmark_node *node, cmark_node_type node_type);
+
+/**
+ */
 CMARK_EXPORT const char*
 cmark_node_get_string_content(cmark_node *node);
 
diff --git a/src/node.c b/src/node.c
@@ -84,6 +84,17 @@ cmark_node_get_type(cmark_node *node)
 	}
 }
 
+int
+cmark_node_set_type(cmark_node *node, cmark_node_type node_type)
+{
+	if (node == NULL) {
+		return 0;
+	} else {
+		node->type = node_type;
+		return 1;
+	}
+}
+
 static const char*
 S_type_string(cmark_node *node)
 {