diff options
author | Nick Wellnhofer <wellnhofer@aevum.de> | 2016-03-12 11:29:55 +0100 |
---|---|---|
committer | Nick Wellnhofer <wellnhofer@aevum.de> | 2016-03-12 11:51:31 +0100 |
commit | 6135e9b953747365358f7f2e23e53cc0e4a701b2 (patch) | |
tree | d93788a09c7548857d3d7a35c64c3ba51493d075 | |
parent | 0e216b4044f1cbbf30df4e378d51d91a0267e680 (diff) |
Don't use variable length arrays
They're not supported by MSVC.
-rw-r--r-- | src/commonmark.c | 4 | ||||
-rw-r--r-- | src/html.c | 4 | ||||
-rw-r--r-- | src/latex.c | 2 | ||||
-rw-r--r-- | src/man.c | 2 | ||||
-rw-r--r-- | src/xml.c | 3 |
5 files changed, 8 insertions, 7 deletions
diff --git a/src/commonmark.c b/src/commonmark.c index 95f5a80..f5a352d 100644 --- a/src/commonmark.c +++ b/src/commonmark.c @@ -17,6 +17,8 @@ #define LIT(s) renderer->out(renderer, s, false, LITERAL) #define CR() renderer->cr(renderer) #define BLANKLINE() renderer->blankline(renderer) +#define ENCODED_SIZE 20 +#define LISTMARKER_SIZE 20 // Functions to convert cmark_nodes to commonmark strings. @@ -26,7 +28,6 @@ static CMARK_INLINE void outc(cmark_renderer *renderer, cmark_escaping escape, bool follows_digit = renderer->buffer->size > 0 && cmark_isdigit(renderer->buffer->ptr[renderer->buffer->size - 1]); - const size_t ENCODED_SIZE = 20; char encoded[ENCODED_SIZE]; needs_escaping = @@ -168,7 +169,6 @@ static int S_render_node(cmark_renderer *renderer, cmark_node *node, bool entering = (ev_type == CMARK_EVENT_ENTER); const char *info, *code, *title; size_t info_len, code_len; - const size_t LISTMARKER_SIZE = 20; char listmarker[LISTMARKER_SIZE]; char *emph_delim; bufsize_t marker_width; @@ -10,6 +10,8 @@ #include "houdini.h" #include "scanners.h" +#define BUFFER_SIZE 100 + // Functions to convert cmark_nodes to HTML strings. static void escape_html(cmark_strbuf *dest, const unsigned char *source, @@ -29,7 +31,6 @@ struct render_state { static void S_render_sourcepos(cmark_node *node, cmark_strbuf *html, int options) { - const size_t BUFFER_SIZE = 100; char buffer[BUFFER_SIZE]; if (CMARK_OPT_SOURCEPOS & options) { snprintf(buffer, BUFFER_SIZE, " data-sourcepos=\"%d:%d-%d:%d\"", @@ -47,7 +48,6 @@ static int S_render_node(cmark_node *node, cmark_event_type ev_type, char start_heading[] = "<h0"; char end_heading[] = "</h0"; bool tight; - const size_t BUFFER_SIZE = 100; char buffer[BUFFER_SIZE]; bool entering = (ev_type == CMARK_EVENT_ENTER); diff --git a/src/latex.c b/src/latex.c index 71559ba..cd2f6f3 100644 --- a/src/latex.c +++ b/src/latex.c @@ -17,6 +17,7 @@ #define LIT(s) renderer->out(renderer, s, false, LITERAL) #define CR() renderer->cr(renderer) #define BLANKLINE() renderer->blankline(renderer) +#define LIST_NUMBER_STRING_SIZE 20 static CMARK_INLINE void outc(cmark_renderer *renderer, cmark_escaping escape, int32_t c, unsigned char nextc) { @@ -217,7 +218,6 @@ static int S_get_enumlevel(cmark_node *node) { static int S_render_node(cmark_renderer *renderer, cmark_node *node, cmark_event_type ev_type, int options) { int list_number; - const size_t LIST_NUMBER_STRING_SIZE = 20; char list_number_string[LIST_NUMBER_STRING_SIZE]; bool entering = (ev_type == CMARK_EVENT_ENTER); cmark_list_type list_type; @@ -14,6 +14,7 @@ #define LIT(s) renderer->out(renderer, s, false, LITERAL) #define CR() renderer->cr(renderer) #define BLANKLINE() renderer->blankline(renderer) +#define LIST_NUMBER_SIZE 20 // Functions to convert cmark_nodes to groff man strings. static void S_outc(cmark_renderer *renderer, cmark_escaping escape, int32_t c, @@ -110,7 +111,6 @@ static int S_render_node(cmark_renderer *renderer, cmark_node *node, tmp = tmp->prev; list_number += 1; } - const size_t LIST_NUMBER_SIZE = 20; char list_number_s[LIST_NUMBER_SIZE]; snprintf(list_number_s, LIST_NUMBER_SIZE, "\"%d.\" 4", list_number); LIT(list_number_s); @@ -9,6 +9,8 @@ #include "buffer.h" #include "houdini.h" +#define BUFFER_SIZE 100 + // Functions to convert cmark_nodes to XML strings. static void escape_xml(cmark_strbuf *dest, const unsigned char *source, @@ -34,7 +36,6 @@ static int S_render_node(cmark_node *node, cmark_event_type ev_type, bool literal = false; cmark_delim_type delim; bool entering = (ev_type == CMARK_EVENT_ENTER); - const size_t BUFFER_SIZE = 100; char buffer[BUFFER_SIZE]; if (entering) { |