cmark

Unnamed repository; edit this file 'description' to name the repository.

commit 2bcca4c2118733f14a91eaf585e8ff97e216b6bd
parent 5de2e4e9d39fd918d041169e2759d4f4b57a0cc6
Author: John MacFarlane <jgm@berkeley.edu>
Date:   Mon, 16 Feb 2015 12:06:51 -0800

Made 'options' an int rather than a long.

For consistency with the API.

Diffstat:
Mman/man3/cmark.3 | 12++++++------
Msrc/blocks.c | 8++++----
Msrc/cmark.h | 10+++++-----
Msrc/html.c | 6+++---
Msrc/inlines.c | 10+++++-----
Msrc/inlines.h | 2+-
Msrc/main.c | 4++--
Msrc/man.c | 2+-
Msrc/parser.h | 2+-
Msrc/xml.c | 4++--
10 files changed, 30 insertions(+), 30 deletions(-)
diff --git a/man/man3/cmark.3 b/man/man3/cmark.3
@@ -1,4 +1,4 @@
-.TH cmark 3 "February 15, 2015" "LOCAL" "Library Functions Manual"
+.TH cmark 3 "February 16, 2015" "LOCAL" "Library Functions Manual"
 .SH
 NAME
 .PP
@@ -437,14 +437,14 @@ Feeds a string of length \f[I]len\f[] to \f[I]parser\f[]\&.
 Finish parsing and return a pointer to a tree of nodes.
 
 .PP
-\fIcmark_node *\f[] \fBcmark_parse_document\f[](\fIconst char *buffer\f[], \fIsize_t len\f[], \fIlong options\f[])
+\fIcmark_node *\f[] \fBcmark_parse_document\f[](\fIconst char *buffer\f[], \fIsize_t len\f[], \fIint options\f[])
 
 .PP
 Parse a CommonMark document in \f[I]buffer\f[] of length \f[I]len\f[]\&.
 Returns a pointer to a tree of nodes.
 
 .PP
-\fIcmark_node *\f[] \fBcmark_parse_file\f[](\fIFILE *f\f[], \fIlong options\f[])
+\fIcmark_node *\f[] \fBcmark_parse_file\f[](\fIFILE *f\f[], \fIint options\f[])
 
 .PP
 Parse a CommonMark document in file \f[I]f\f[], returning a pointer to
@@ -454,20 +454,20 @@ a tree of nodes.
 Rendering
 
 .PP
-\fIchar *\f[] \fBcmark_render_xml\f[](\fIcmark_node *root\f[], \fIlong options\f[])
+\fIchar *\f[] \fBcmark_render_xml\f[](\fIcmark_node *root\f[], \fIint options\f[])
 
 .PP
 Render a \f[I]node\f[] tree as XML.
 
 .PP
-\fIchar *\f[] \fBcmark_render_html\f[](\fIcmark_node *root\f[], \fIlong options\f[])
+\fIchar *\f[] \fBcmark_render_html\f[](\fIcmark_node *root\f[], \fIint options\f[])
 
 .PP
 Render a \f[I]node\f[] tree as an HTML fragment.  It is up to the user
 to add an appropriate header and footer.
 
 .PP
-\fIchar *\f[] \fBcmark_render_man\f[](\fIcmark_node *root\f[], \fIlong options\f[])
+\fIchar *\f[] \fBcmark_render_man\f[](\fIcmark_node *root\f[], \fIint options\f[])
 
 .PP
 Render a \f[I]node\f[] tree as a groff man page, without the header.
diff --git a/src/blocks.c b/src/blocks.c
@@ -50,7 +50,7 @@ static cmark_node* make_document()
 	return e;
 }
 
-cmark_parser *cmark_parser_new(long options)
+cmark_parser *cmark_parser_new(int options)
 {
 	cmark_parser *parser = (cmark_parser*)malloc(sizeof(cmark_parser));
 	cmark_node *document = make_document();
@@ -317,7 +317,7 @@ static cmark_node* add_child(cmark_parser *parser, cmark_node* parent,
 
 // Walk through cmark_node and all children, recursively, parsing
 // string content into inline content where appropriate.
-static void process_inlines(cmark_node* root, cmark_reference_map *refmap, long options)
+static void process_inlines(cmark_node* root, cmark_reference_map *refmap, int options)
 {
 	cmark_iter *iter = cmark_iter_new(root);
 	cmark_node *cur;
@@ -422,7 +422,7 @@ static cmark_node *finalize_document(cmark_parser *parser)
 	return parser->root;
 }
 
-cmark_node *cmark_parse_file(FILE *f, long options)
+cmark_node *cmark_parse_file(FILE *f, int options)
 {
 	unsigned char buffer[4096];
 	cmark_parser *parser = cmark_parser_new(options);
@@ -442,7 +442,7 @@ cmark_node *cmark_parse_file(FILE *f, long options)
 	return document;
 }
 
-cmark_node *cmark_parse_document(const char *buffer, size_t len, long options)
+cmark_node *cmark_parse_document(const char *buffer, size_t len, int options)
 {
 	cmark_parser *parser = cmark_parser_new(options);
 	cmark_node *document;
diff --git a/src/cmark.h b/src/cmark.h
@@ -452,13 +452,13 @@ cmark_node *cmark_parser_finish(cmark_parser *parser);
  * Returns a pointer to a tree of nodes.
  */
 CMARK_EXPORT
-cmark_node *cmark_parse_document(const char *buffer, size_t len, long options);
+cmark_node *cmark_parse_document(const char *buffer, size_t len, int options);
 
 /** Parse a CommonMark document in file 'f', returning a pointer to
  * a tree of nodes.
  */
 CMARK_EXPORT
-cmark_node *cmark_parse_file(FILE *f, long options);
+cmark_node *cmark_parse_file(FILE *f, int options);
 
 /**
  * ## Rendering
@@ -467,18 +467,18 @@ cmark_node *cmark_parse_file(FILE *f, long options);
 /** Render a 'node' tree as XML.
  */
 CMARK_EXPORT
-char *cmark_render_xml(cmark_node *root, long options);
+char *cmark_render_xml(cmark_node *root, int options);
 
 /** Render a 'node' tree as an HTML fragment.  It is up to the user
  * to add an appropriate header and footer.
  */
 CMARK_EXPORT
-char *cmark_render_html(cmark_node *root, long options);
+char *cmark_render_html(cmark_node *root, int options);
 
 /** Render a 'node' tree as a groff man page, without the header.
  */
 CMARK_EXPORT
-char *cmark_render_man(cmark_node *root, long options);
+char *cmark_render_man(cmark_node *root, int options);
 
 /** Default writer options.
  */
diff --git a/src/html.c b/src/html.c
@@ -39,7 +39,7 @@ struct render_state {
 };
 
 static void
-S_render_sourcepos(cmark_node *node, cmark_strbuf *html, long options)
+S_render_sourcepos(cmark_node *node, cmark_strbuf *html, int options)
 {
 	if (CMARK_OPT_SOURCEPOS & options) {
 		cmark_strbuf_printf(html, " data-sourcepos=\"%d:%d-%d:%d\"",
@@ -52,7 +52,7 @@ S_render_sourcepos(cmark_node *node, cmark_strbuf *html, long options)
 
 static int
 S_render_node(cmark_node *node, cmark_event_type ev_type,
-              struct render_state *state, long options)
+              struct render_state *state, int options)
 {
 	cmark_node *parent;
 	cmark_node *grandparent;
@@ -302,7 +302,7 @@ S_render_node(cmark_node *node, cmark_event_type ev_type,
 	return 1;
 }
 
-char *cmark_render_html(cmark_node *root, long options)
+char *cmark_render_html(cmark_node *root, int options)
 {
 	char *result;
 	cmark_strbuf html = GH_BUF_INIT;
diff --git a/src/inlines.c b/src/inlines.c
@@ -53,11 +53,11 @@ typedef struct {
 static delimiter*
 S_insert_emph(subject *subj, delimiter *opener, delimiter *closer);
 
-static int parse_inline(subject* subj, cmark_node * parent, long options);
+static int parse_inline(subject* subj, cmark_node * parent, int options);
 
 static void subject_from_buf(subject *e, cmark_strbuf *buffer,
                              cmark_reference_map *refmap);
-static int subject_find_special_char(subject *subj, long options);
+static int subject_find_special_char(subject *subj, int options);
 
 static unsigned char *cmark_clean_autolink(cmark_chunk *url, int is_email)
 {
@@ -924,7 +924,7 @@ static cmark_node* handle_newline(subject *subj)
 	}
 }
 
-static int subject_find_special_char(subject *subj, long options)
+static int subject_find_special_char(subject *subj, int options)
 {
 	// "\n\\`&_*[]<!"
 	static const int8_t SPECIAL_CHARS[256] = {
@@ -982,7 +982,7 @@ static int subject_find_special_char(subject *subj, long options)
 
 // Parse an inline, advancing subject, and add it as a child of parent.
 // Return 0 if no inline can be parsed, 1 otherwise.
-static int parse_inline(subject* subj, cmark_node * parent, long options)
+static int parse_inline(subject* subj, cmark_node * parent, int options)
 {
 	cmark_node* new_inl = NULL;
 	cmark_chunk contents;
@@ -1058,7 +1058,7 @@ static int parse_inline(subject* subj, cmark_node * parent, long options)
 }
 
 // Parse inlines from parent's string_content, adding as children of parent.
-extern void cmark_parse_inlines(cmark_node* parent, cmark_reference_map *refmap, long options)
+extern void cmark_parse_inlines(cmark_node* parent, cmark_reference_map *refmap, int options)
 {
 	subject subj;
 	subject_from_buf(&subj, &parent->string_content, refmap);
diff --git a/src/inlines.h b/src/inlines.h
@@ -8,7 +8,7 @@ extern "C" {
 unsigned char *cmark_clean_url(cmark_chunk *url);
 unsigned char *cmark_clean_title(cmark_chunk *title);
 
-void cmark_parse_inlines(cmark_node* parent, cmark_reference_map *refmap, long options);
+void cmark_parse_inlines(cmark_node* parent, cmark_reference_map *refmap, int options);
 
 int cmark_parse_reference_inline(cmark_strbuf *input, cmark_reference_map *refmap);
 
diff --git a/src/main.c b/src/main.c
@@ -33,7 +33,7 @@ void print_usage()
 }
 
 static void print_document(cmark_node *document, writer_format writer,
-                           long options)
+                           int options)
 {
 	char *result;
 	switch (writer) {
@@ -63,7 +63,7 @@ int main(int argc, char *argv[])
 	size_t bytes;
 	cmark_node *document;
 	writer_format writer = FORMAT_HTML;
-	long options = CMARK_OPT_DEFAULT;
+	int options = CMARK_OPT_DEFAULT;
 
 #if defined(_WIN32) && !defined(__CYGWIN__)
 	_setmode(_fileno(stdout), _O_BINARY);
diff --git a/src/man.c b/src/man.c
@@ -262,7 +262,7 @@ S_render_node(cmark_node *node, cmark_event_type ev_type,
 	return 1;
 }
 
-char *cmark_render_man(cmark_node *root, long options)
+char *cmark_render_man(cmark_node *root, int options)
 {
 	char *result;
 	cmark_strbuf man = GH_BUF_INIT;
diff --git a/src/parser.h b/src/parser.h
@@ -19,7 +19,7 @@ struct cmark_parser {
 	cmark_strbuf *curline;
 	int last_line_length;
 	cmark_strbuf *linebuf;
-	long options;
+	int options;
 };
 
 #ifdef __cplusplus
diff --git a/src/xml.c b/src/xml.c
@@ -36,7 +36,7 @@ static inline void indent(struct render_state *state)
 
 static int
 S_render_node(cmark_node *node, cmark_event_type ev_type,
-              struct render_state *state, long options)
+              struct render_state *state, int options)
 {
 	cmark_strbuf *xml = state->xml;
 	bool literal = false;
@@ -145,7 +145,7 @@ S_render_node(cmark_node *node, cmark_event_type ev_type,
 	return 1;
 }
 
-char *cmark_render_xml(cmark_node *root, long options)
+char *cmark_render_xml(cmark_node *root, int options)
 {
 	char *result;
 	cmark_strbuf xml = GH_BUF_INIT;