summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Wellnhofer <wellnhofer@aevum.de>2016-03-12 11:13:14 +0100
committerNick Wellnhofer <wellnhofer@aevum.de>2016-03-12 11:13:14 +0100
commit0e216b4044f1cbbf30df4e378d51d91a0267e680 (patch)
treef92e1216c64d92cdc3c517756de70971e3dbd752
parent8bff268ba84c67a1ac2761679457532439da482b (diff)
Switch from "inline" to "CMARK_INLINE"
Newer MSVC versions support enough of C99 to be able to compile cmark in plain C mode. Only the "inline" keyword is still unsupported. We have to use "__inline" instead.
-rw-r--r--src/blocks.c10
-rw-r--r--src/buffer.c2
-rw-r--r--src/commonmark.c2
-rw-r--r--src/html.c2
-rw-r--r--src/inlines.c22
-rw-r--r--src/latex.c2
-rw-r--r--src/node.c4
-rw-r--r--src/render.c4
-rw-r--r--src/xml.c2
9 files changed, 25 insertions, 25 deletions
diff --git a/src/blocks.c b/src/blocks.c
index 925585d..00639cf 100644
--- a/src/blocks.c
+++ b/src/blocks.c
@@ -30,11 +30,11 @@
#define peek_at(i, n) (i)->data[n]
-static inline bool S_is_line_end_char(char c) {
+static CMARK_INLINE bool S_is_line_end_char(char c) {
return (c == '\n' || c == '\r');
}
-static inline bool S_is_space_or_tab(char c) {
+static CMARK_INLINE bool S_is_space_or_tab(char c) {
return (c == ' ' || c == '\t');
}
@@ -126,7 +126,7 @@ static bool is_blank(cmark_strbuf *s, bufsize_t offset) {
return true;
}
-static inline bool can_contain(cmark_node_type parent_type,
+static CMARK_INLINE bool can_contain(cmark_node_type parent_type,
cmark_node_type child_type) {
return (parent_type == CMARK_NODE_DOCUMENT ||
parent_type == CMARK_NODE_BLOCK_QUOTE ||
@@ -134,13 +134,13 @@ static inline bool can_contain(cmark_node_type parent_type,
(parent_type == CMARK_NODE_LIST && child_type == CMARK_NODE_ITEM));
}
-static inline bool accepts_lines(cmark_node_type block_type) {
+static CMARK_INLINE bool accepts_lines(cmark_node_type block_type) {
return (block_type == CMARK_NODE_PARAGRAPH ||
block_type == CMARK_NODE_HEADING ||
block_type == CMARK_NODE_CODE_BLOCK);
}
-static inline bool contains_inlines(cmark_node_type block_type) {
+static CMARK_INLINE bool contains_inlines(cmark_node_type block_type) {
return (block_type == CMARK_NODE_PARAGRAPH ||
block_type == CMARK_NODE_HEADING);
}
diff --git a/src/buffer.c b/src/buffer.c
index a9d36e7..4efa97b 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -33,7 +33,7 @@ void cmark_strbuf_overflow_err() {
abort();
}
-static inline void S_strbuf_grow_by(cmark_strbuf *buf, size_t add) {
+static CMARK_INLINE void S_strbuf_grow_by(cmark_strbuf *buf, size_t add) {
size_t target_size = (size_t)buf->size + add;
if (target_size < add /* Integer overflow. */
diff --git a/src/commonmark.c b/src/commonmark.c
index 0667519..95f5a80 100644
--- a/src/commonmark.c
+++ b/src/commonmark.c
@@ -20,7 +20,7 @@
// Functions to convert cmark_nodes to commonmark strings.
-static inline void outc(cmark_renderer *renderer, cmark_escaping escape,
+static CMARK_INLINE void outc(cmark_renderer *renderer, cmark_escaping escape,
int32_t c, unsigned char nextc) {
bool needs_escaping = false;
bool follows_digit =
diff --git a/src/html.c b/src/html.c
index 27e0586..753e5e2 100644
--- a/src/html.c
+++ b/src/html.c
@@ -17,7 +17,7 @@ static void escape_html(cmark_strbuf *dest, const unsigned char *source,
houdini_escape_html0(dest, source, length, 0);
}
-static inline void cr(cmark_strbuf *html) {
+static CMARK_INLINE void cr(cmark_strbuf *html) {
if (html->size && html->ptr[html->size - 1] != '\n')
cmark_strbuf_putc(html, '\n');
}
diff --git a/src/inlines.c b/src/inlines.c
index 1199831..8ff8131 100644
--- a/src/inlines.c
+++ b/src/inlines.c
@@ -48,7 +48,7 @@ typedef struct {
delimiter *last_delim;
} subject;
-static inline bool S_is_line_end_char(char c) {
+static CMARK_INLINE bool S_is_line_end_char(char c) {
return (c == '\n' || c == '\r');
}
@@ -62,7 +62,7 @@ static void subject_from_buf(subject *e, cmark_strbuf *buffer,
static bufsize_t subject_find_special_char(subject *subj, int options);
// Create an inline with a literal string value.
-static inline cmark_node *make_literal(cmark_node_type t, cmark_chunk s) {
+static CMARK_INLINE cmark_node *make_literal(cmark_node_type t, cmark_chunk s) {
cmark_node *e = (cmark_node *)calloc(1, sizeof(*e));
if (e != NULL) {
e->type = t;
@@ -81,7 +81,7 @@ static inline cmark_node *make_literal(cmark_node_type t, cmark_chunk s) {
}
// Create an inline with no value.
-static inline cmark_node *make_simple(cmark_node_type t) {
+static CMARK_INLINE cmark_node *make_simple(cmark_node_type t) {
cmark_node *e = (cmark_node *)calloc(1, sizeof(*e));
if (e != NULL) {
e->type = t;
@@ -141,7 +141,7 @@ static cmark_chunk cmark_clean_autolink(cmark_chunk *url, int is_email) {
return cmark_chunk_buf_detach(&buf);
}
-static inline cmark_node *make_autolink(cmark_chunk url, int is_email) {
+static CMARK_INLINE cmark_node *make_autolink(cmark_chunk url, int is_email) {
cmark_node *link = make_simple(CMARK_NODE_LINK);
link->as.link.url = cmark_clean_autolink(&url, is_email);
link->as.link.title = cmark_chunk_literal("");
@@ -159,28 +159,28 @@ static void subject_from_buf(subject *e, cmark_strbuf *buffer,
e->last_delim = NULL;
}
-static inline int isbacktick(int c) { return (c == '`'); }
+static CMARK_INLINE int isbacktick(int c) { return (c == '`'); }
-static inline unsigned char peek_char(subject *subj) {
+static CMARK_INLINE unsigned char peek_char(subject *subj) {
// NULL bytes should have been stripped out by now. If they're
// present, it's a programming error:
assert(!(subj->pos < subj->input.len && subj->input.data[subj->pos] == 0));
return (subj->pos < subj->input.len) ? subj->input.data[subj->pos] : 0;
}
-static inline unsigned char peek_at(subject *subj, bufsize_t pos) {
+static CMARK_INLINE unsigned char peek_at(subject *subj, bufsize_t pos) {
return subj->input.data[pos];
}
// Return true if there are more characters in the subject.
-static inline int is_eof(subject *subj) {
+static CMARK_INLINE int is_eof(subject *subj) {
return (subj->pos >= subj->input.len);
}
// Advance the subject. Doesn't check for eof.
#define advance(subj) (subj)->pos += 1
-static inline bool skip_spaces(subject *subj) {
+static CMARK_INLINE bool skip_spaces(subject *subj) {
bool skipped = false;
while (peek_char(subj) == ' ' || peek_char(subj) == '\t') {
advance(subj);
@@ -189,7 +189,7 @@ static inline bool skip_spaces(subject *subj) {
return skipped;
}
-static inline bool skip_line_end(subject *subj) {
+static CMARK_INLINE bool skip_line_end(subject *subj) {
bool seen_line_end_char = false;
if (peek_char(subj) == '\r') {
advance(subj);
@@ -203,7 +203,7 @@ static inline bool skip_line_end(subject *subj) {
}
// Take characters while a predicate holds, and return a string.
-static inline cmark_chunk take_while(subject *subj, int (*f)(int)) {
+static CMARK_INLINE cmark_chunk take_while(subject *subj, int (*f)(int)) {
unsigned char c;
bufsize_t startpos = subj->pos;
bufsize_t len = 0;
diff --git a/src/latex.c b/src/latex.c
index 879f813..71559ba 100644
--- a/src/latex.c
+++ b/src/latex.c
@@ -18,7 +18,7 @@
#define CR() renderer->cr(renderer)
#define BLANKLINE() renderer->blankline(renderer)
-static inline void outc(cmark_renderer *renderer, cmark_escaping escape,
+static CMARK_INLINE void outc(cmark_renderer *renderer, cmark_escaping escape,
int32_t c, unsigned char nextc) {
if (escape == LITERAL) {
cmark_render_code_point(renderer, c);
diff --git a/src/node.c b/src/node.c
index 26a8e25..00edbb1 100644
--- a/src/node.c
+++ b/src/node.c
@@ -6,7 +6,7 @@
static void S_node_unlink(cmark_node *node);
-static inline bool S_is_block(cmark_node *node) {
+static CMARK_INLINE bool S_is_block(cmark_node *node) {
if (node == NULL) {
return false;
}
@@ -14,7 +14,7 @@ static inline bool S_is_block(cmark_node *node) {
node->type <= CMARK_NODE_LAST_BLOCK;
}
-static inline bool S_is_inline(cmark_node *node) {
+static CMARK_INLINE bool S_is_inline(cmark_node *node) {
if (node == NULL) {
return false;
}
diff --git a/src/render.c b/src/render.c
index fea9b3a..50f03e6 100644
--- a/src/render.c
+++ b/src/render.c
@@ -5,13 +5,13 @@
#include "utf8.h"
#include "render.h"
-static inline void S_cr(cmark_renderer *renderer) {
+static CMARK_INLINE void S_cr(cmark_renderer *renderer) {
if (renderer->need_cr < 1) {
renderer->need_cr = 1;
}
}
-static inline void S_blankline(cmark_renderer *renderer) {
+static CMARK_INLINE void S_blankline(cmark_renderer *renderer) {
if (renderer->need_cr < 2) {
renderer->need_cr = 2;
}
diff --git a/src/xml.c b/src/xml.c
index b630810..fc33886 100644
--- a/src/xml.c
+++ b/src/xml.c
@@ -21,7 +21,7 @@ struct render_state {
int indent;
};
-static inline void indent(struct render_state *state) {
+static CMARK_INLINE void indent(struct render_state *state) {
int i;
for (i = 0; i < state->indent; i++) {
cmark_strbuf_putc(state->xml, ' ');