From 20818f877471489498a389b665071c02fc9d7294 Mon Sep 17 00:00:00 2001 From: Matthew Hughes Date: Mon, 1 Apr 2024 19:10:39 +0100 Subject: [PATCH 1/4] Fix `copy-lib` script not bailing on invalid args I mean, it would bail soon after due to `nounset`, but this is more helpful --- scripts/copy-lib | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/copy-lib b/scripts/copy-lib index c1ec8e2..2aeb15a 100755 --- a/scripts/copy-lib +++ b/scripts/copy-lib @@ -5,6 +5,7 @@ set -o errexit -o nounset -o pipefail if [ $# -ne 1 ] then echo "usage: $0 " + exit 1 fi submodule_path="$1" From 20a92228a1a616dc06c9f96178751e6414e46057 Mon Sep 17 00:00:00 2001 From: Matthew Hughes Date: Mon, 1 Apr 2024 19:14:29 +0100 Subject: [PATCH 2/4] Update `pre-commit` I.e. run pre-commit autoupdate --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e523b74..e49f545 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -8,11 +8,11 @@ repos: hooks: - id: validate-changelog - repo: https://github.com/golangci/golangci-lint - rev: v1.54.2 + rev: v1.57.2 hooks: - id: golangci-lint - repo: https://github.com/segmentio/golines - rev: v0.11.0 + rev: v0.12.2 hooks: - id: golines - repo: https://gitlab.com/matthewhughes/nobarenolint From 9cd2301013c0576803d41bec64ab77809027d4d1 Mon Sep 17 00:00:00 2001 From: Matthew Hughes Date: Mon, 1 Apr 2024 19:18:05 +0100 Subject: [PATCH 3/4] CI: don't run golangci-lint separate from others Run it like any other linter, mostly because managing version in two separate places is a pain --- .github/workflows/pr.yaml | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index af9d86b..cc0a56e 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -37,26 +37,12 @@ jobs: BEGIN {fail = 0} NR > 1 && $NF == 0 { fail = 1; printf("bad line: %s\n", $0) } END { if (fail) { exit(1) } }' go-cov.out - golangci-lint: - runs-on: ubuntu-latest - steps: - - name: checkout - uses: actions/checkout@v3 - - name: setup go - uses: actions/setup-go@v4 - with: - cache: false - - name: golangci-lint - uses: golangci/golangci-lint-action@v3 pre-commit: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - uses: actions/setup-python@v3 - uses: pre-commit/action@v3.0.0 - env: - # run this separately since it handles it's own caching - SKIP: golangci-lint check-generated-code: runs-on: ubuntu-latest steps: From da4c1e2bccf0971313d68c40172e72188fc691c8 Mon Sep 17 00:00:00 2001 From: Matthew Hughes Date: Mon, 1 Apr 2024 19:12:22 +0100 Subject: [PATCH 4/4] Update `cmark` Bump from v0.30.2 to v0.31.0 --- cmark-src | 2 +- pkg/cmark/blocks.c | 64 ++++++++---- pkg/cmark/buffer.c | 21 ++-- pkg/cmark/buffer.h | 14 +-- pkg/cmark/case_fold_switch.inc | 4 +- pkg/cmark/chunk.h | 22 ++--- pkg/cmark/cmark.c | 4 +- pkg/cmark/cmark.h | 38 +++++++- pkg/cmark/cmark_ctype.c | 4 +- pkg/cmark/cmark_ctype.h | 4 +- pkg/cmark/cmark_export.h | 4 +- pkg/cmark/cmark_version.h | 4 +- pkg/cmark/commonmark.c | 23 ++--- pkg/cmark/config.h | 4 +- pkg/cmark/entities.inc | 4 +- pkg/cmark/houdini.h | 14 +-- pkg/cmark/houdini_href_e.c | 15 ++- pkg/cmark/houdini_html_e.c | 15 ++- pkg/cmark/houdini_html_u.c | 15 ++- pkg/cmark/html.c | 26 ++--- pkg/cmark/inlines.c | 90 ++++++++++------- pkg/cmark/inlines.h | 4 +- pkg/cmark/iterator.c | 6 +- pkg/cmark/iterator.h | 4 +- pkg/cmark/latex.c | 14 +-- pkg/cmark/man.c | 10 +- pkg/cmark/node.c | 10 +- pkg/cmark/node.h | 9 +- pkg/cmark/parser.h | 4 +- pkg/cmark/references.c | 8 +- pkg/cmark/references.h | 4 +- pkg/cmark/render.c | 10 +- pkg/cmark/render.h | 6 +- pkg/cmark/scanners.c | 4 +- pkg/cmark/scanners.h | 4 +- pkg/cmark/utf8.c | 173 ++++++++++++++++++++++++++++++++- pkg/cmark/utf8.h | 5 +- pkg/cmark/xml.c | 14 +-- 38 files changed, 477 insertions(+), 203 deletions(-) diff --git a/cmark-src b/cmark-src index 5ba25ff..8fbf029 160000 --- a/cmark-src +++ b/cmark-src @@ -1 +1 @@ -Subproject commit 5ba25ff40eba44c811f79ab6a792baf945b8307c +Subproject commit 8fbf029685482827828b5858444157052f1b0a5f diff --git a/pkg/cmark/blocks.c b/pkg/cmark/blocks.c index 9ee5993..24e6b53 100644 --- a/pkg/cmark/blocks.c +++ b/pkg/cmark/blocks.c @@ -1,5 +1,5 @@ -// Code generated by ../../scripts/copy-lib ../../cmark-src at 5ba25ff40eba44c811f79ab6a792baf945b8307c DO NOT EDIT. -// See ../../cmark-src/COPYING for license +// Code generated by ../../scripts/copy-lib ../../cmark-src/ at +8fbf029685482827828b5858444157052f1b0a5f DO NOT EDIT. +// See ../../cmark-src//COPYING for license /** * Block parsing implementation. * @@ -7,13 +7,13 @@ * see http://spec.commonmark.org/0.24/#phase-1-block-structure */ -#include #include -#include #include +#include +#include +#include #include "cmark_ctype.h" -#include "config.h" #include "parser.h" #include "cmark.h" #include "node.h" @@ -42,7 +42,7 @@ static bool S_last_line_checked(const cmark_node *node) { return (node->flags & CMARK_NODE__LAST_LINE_CHECKED) != 0; } -static CMARK_INLINE cmark_node_type S_type(const cmark_node *node) { +static inline cmark_node_type S_type(const cmark_node *node) { return (cmark_node_type)node->type; } @@ -57,11 +57,11 @@ static void S_set_last_line_checked(cmark_node *node) { node->flags |= CMARK_NODE__LAST_LINE_CHECKED; } -static CMARK_INLINE bool S_is_line_end_char(char c) { +static inline bool S_is_line_end_char(char c) { return (c == '\n' || c == '\r'); } -static CMARK_INLINE bool S_is_space_or_tab(char c) { +static inline bool S_is_space_or_tab(char c) { return (c == ' ' || c == '\t'); } @@ -92,19 +92,17 @@ static cmark_node *make_document(cmark_mem *mem) { return e; } -cmark_parser *cmark_parser_new_with_mem(int options, cmark_mem *mem) { +cmark_parser *cmark_parser_new_with_mem_into_root(int options, cmark_mem *mem, cmark_node *root) { cmark_parser *parser = (cmark_parser *)mem->calloc(1, sizeof(cmark_parser)); parser->mem = mem; - cmark_node *document = make_document(mem); - cmark_strbuf_init(mem, &parser->curline, 256); cmark_strbuf_init(mem, &parser->linebuf, 0); cmark_strbuf_init(mem, &parser->content, 0); parser->refmap = cmark_reference_map_new(mem); - parser->root = document; - parser->current = document; + parser->root = root; + parser->current = root; parser->line_number = 0; parser->offset = 0; parser->column = 0; @@ -121,6 +119,11 @@ cmark_parser *cmark_parser_new_with_mem(int options, cmark_mem *mem) { return parser; } +cmark_parser *cmark_parser_new_with_mem(int options, cmark_mem *mem) { + cmark_node *document = make_document(mem); + return cmark_parser_new_with_mem_into_root(options, mem, document); +} + cmark_parser *cmark_parser_new(int options) { extern cmark_mem DEFAULT_MEM_ALLOCATOR; return cmark_parser_new_with_mem(options, &DEFAULT_MEM_ALLOCATOR); @@ -157,21 +160,21 @@ static bool is_blank(cmark_strbuf *s, bufsize_t offset) { return true; } -static CMARK_INLINE bool can_contain(cmark_node_type parent_type, - cmark_node_type child_type) { +static 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 || parent_type == CMARK_NODE_ITEM || (parent_type == CMARK_NODE_LIST && child_type == CMARK_NODE_ITEM)); } -static CMARK_INLINE bool accepts_lines(cmark_node_type block_type) { +static 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 CMARK_INLINE bool contains_inlines(cmark_node_type block_type) { +static inline bool contains_inlines(cmark_node_type block_type) { return (block_type == CMARK_NODE_PARAGRAPH || block_type == CMARK_NODE_HEADING); } @@ -578,7 +581,7 @@ static void S_parser_feed(cmark_parser *parser, const unsigned char *buffer, if (len > UINT_MAX - parser->total_size) parser->total_size = UINT_MAX; else - parser->total_size += len; + parser->total_size += (int)len; // Skip UTF-8 BOM if present; see #334 if (parser->line_number == 0 && parser->column == 0 && len >= 3 && @@ -906,6 +909,31 @@ static cmark_node *check_open_blocks(cmark_parser *parser, cmark_chunk *input, if (!parse_block_quote_prefix(parser, input)) goto done; break; + case CMARK_NODE_LIST: + // Avoid quadratic behavior caused by iterating deeply nested lists + // for each blank line. + if (parser->blank) { + if (container->flags & CMARK_NODE__LIST_LAST_LINE_BLANK && + parser->indent == 0) { + // Abort early if we encounter multiple blank lines. Returning + // NULL will cause S_process_line to skip the calls to + // open_new_blocks and add_text_to_container. open_new_blocks + // is a no-op for blank lines. add_text_to_container closes + // remaining open nodes, but since we have a second blank + // line, all open nodes have already been closed when the + // first blank line was processed. Certain block types accept + // empty lines as content, so add them here. + if (parser->current->type == CMARK_NODE_CODE_BLOCK || + parser->current->type == CMARK_NODE_HTML_BLOCK) { + add_line(input, parser); + } + return NULL; + } + container->flags |= CMARK_NODE__LIST_LAST_LINE_BLANK; + } else { + container->flags &= ~CMARK_NODE__LIST_LAST_LINE_BLANK; + } + break; case CMARK_NODE_ITEM: if (!parse_node_item_prefix(parser, input, container)) goto done; diff --git a/pkg/cmark/buffer.c b/pkg/cmark/buffer.c index d0e5bfd..edd15af 100644 --- a/pkg/cmark/buffer.c +++ b/pkg/cmark/buffer.c @@ -1,15 +1,14 @@ -// Code generated by ../../scripts/copy-lib ../../cmark-src at 5ba25ff40eba44c811f79ab6a792baf945b8307c DO NOT EDIT. -// See ../../cmark-src/COPYING for license -#include -#include +// Code generated by ../../scripts/copy-lib ../../cmark-src/ at +8fbf029685482827828b5858444157052f1b0a5f DO NOT EDIT. +// See ../../cmark-src//COPYING for license #include -#include +#include +#include +#include +#include #include #include -#include -#include +#include -#include "config.h" #include "cmark_ctype.h" #include "buffer.h" @@ -33,7 +32,7 @@ void cmark_strbuf_init(cmark_mem *mem, cmark_strbuf *buf, cmark_strbuf_grow(buf, initial_size); } -static CMARK_INLINE void S_strbuf_grow_by(cmark_strbuf *buf, bufsize_t add) { +static inline void S_strbuf_grow_by(cmark_strbuf *buf, bufsize_t add) { cmark_strbuf_grow(buf, buf->size + add); } @@ -97,7 +96,7 @@ void cmark_strbuf_set(cmark_strbuf *buf, const unsigned char *data, void cmark_strbuf_sets(cmark_strbuf *buf, const char *string) { cmark_strbuf_set(buf, (const unsigned char *)string, - string ? strlen(string) : 0); + string ? (bufsize_t)strlen(string) : 0); } void cmark_strbuf_putc(cmark_strbuf *buf, int c) { @@ -118,7 +117,7 @@ void cmark_strbuf_put(cmark_strbuf *buf, const unsigned char *data, } void cmark_strbuf_puts(cmark_strbuf *buf, const char *string) { - cmark_strbuf_put(buf, (const unsigned char *)string, strlen(string)); + cmark_strbuf_put(buf, (const unsigned char *)string, (bufsize_t)strlen(string)); } void cmark_strbuf_copy_cstr(char *data, bufsize_t datasize, diff --git a/pkg/cmark/buffer.h b/pkg/cmark/buffer.h index 0570be3..1d3e551 100644 --- a/pkg/cmark/buffer.h +++ b/pkg/cmark/buffer.h @@ -1,14 +1,14 @@ -// Code generated by ../../scripts/copy-lib ../../cmark-src at 5ba25ff40eba44c811f79ab6a792baf945b8307c DO NOT EDIT. -// See ../../cmark-src/COPYING for license +// Code generated by ../../scripts/copy-lib ../../cmark-src/ at +8fbf029685482827828b5858444157052f1b0a5f DO NOT EDIT. +// See ../../cmark-src//COPYING for license #ifndef CMARK_BUFFER_H #define CMARK_BUFFER_H -#include -#include -#include #include +#include +#include #include -#include "config.h" +#include + #include "cmark.h" #ifdef __cplusplus @@ -54,7 +54,7 @@ void cmark_strbuf_copy_cstr(char *data, bufsize_t datasize, const cmark_strbuf *buf); /* -static CMARK_INLINE const char *cmark_strbuf_cstr(const cmark_strbuf *buf) { +static inline const char *cmark_strbuf_cstr(const cmark_strbuf *buf) { return (char *)buf->ptr; } */ diff --git a/pkg/cmark/case_fold_switch.inc b/pkg/cmark/case_fold_switch.inc index 7f70d5f..ad03b27 100644 --- a/pkg/cmark/case_fold_switch.inc +++ b/pkg/cmark/case_fold_switch.inc @@ -1,5 +1,5 @@ -// Code generated by ../../scripts/copy-lib ../../cmark-src at 5ba25ff40eba44c811f79ab6a792baf945b8307c DO NOT EDIT. -// See ../../cmark-src/COPYING for license +// Code generated by ../../scripts/copy-lib ../../cmark-src/ at +8fbf029685482827828b5858444157052f1b0a5f DO NOT EDIT. +// See ../../cmark-src//COPYING for license switch (c) { case 0x0041: bufpush(0x0061); diff --git a/pkg/cmark/chunk.h b/pkg/cmark/chunk.h index 22d010a..1ec8d0f 100644 --- a/pkg/cmark/chunk.h +++ b/pkg/cmark/chunk.h @@ -1,5 +1,5 @@ -// Code generated by ../../scripts/copy-lib ../../cmark-src at 5ba25ff40eba44c811f79ab6a792baf945b8307c DO NOT EDIT. -// See ../../cmark-src/COPYING for license +// Code generated by ../../scripts/copy-lib ../../cmark-src/ at +8fbf029685482827828b5858444157052f1b0a5f DO NOT EDIT. +// See ../../cmark-src//COPYING for license #ifndef CMARK_CHUNK_H #define CMARK_CHUNK_H @@ -19,19 +19,19 @@ typedef struct { } cmark_chunk; // NOLINTNEXTLINE(clang-diagnostic-unused-function) -static CMARK_INLINE void cmark_chunk_free(cmark_chunk *c) { +static inline void cmark_chunk_free(cmark_chunk *c) { c->data = NULL; c->len = 0; } -static CMARK_INLINE void cmark_chunk_ltrim(cmark_chunk *c) { +static inline void cmark_chunk_ltrim(cmark_chunk *c) { while (c->len && cmark_isspace(c->data[0])) { c->data++; c->len--; } } -static CMARK_INLINE void cmark_chunk_rtrim(cmark_chunk *c) { +static inline void cmark_chunk_rtrim(cmark_chunk *c) { while (c->len > 0) { if (!cmark_isspace(c->data[c->len - 1])) break; @@ -41,29 +41,29 @@ static CMARK_INLINE void cmark_chunk_rtrim(cmark_chunk *c) { } // NOLINTNEXTLINE(clang-diagnostic-unused-function) -static CMARK_INLINE void cmark_chunk_trim(cmark_chunk *c) { +static inline void cmark_chunk_trim(cmark_chunk *c) { cmark_chunk_ltrim(c); cmark_chunk_rtrim(c); } // NOLINTNEXTLINE(clang-diagnostic-unused-function) -static CMARK_INLINE bufsize_t cmark_chunk_strchr(cmark_chunk *ch, int c, - bufsize_t offset) { +static inline bufsize_t cmark_chunk_strchr(cmark_chunk *ch, int c, + bufsize_t offset) { const unsigned char *p = (unsigned char *)memchr(ch->data + offset, c, ch->len - offset); return p ? (bufsize_t)(p - ch->data) : ch->len; } // NOLINTNEXTLINE(clang-diagnostic-unused-function) -static CMARK_INLINE cmark_chunk cmark_chunk_literal(const char *data) { +static inline cmark_chunk cmark_chunk_literal(const char *data) { bufsize_t len = data ? (bufsize_t)strlen(data) : 0; cmark_chunk c = {(unsigned char *)data, len}; return c; } // NOLINTNEXTLINE(clang-diagnostic-unused-function) -static CMARK_INLINE cmark_chunk cmark_chunk_dup(const cmark_chunk *ch, - bufsize_t pos, bufsize_t len) { +static inline cmark_chunk cmark_chunk_dup(const cmark_chunk *ch, bufsize_t pos, + bufsize_t len) { cmark_chunk c = {ch->data + pos, len}; return c; } diff --git a/pkg/cmark/cmark.c b/pkg/cmark/cmark.c index 1ff8628..60d5793 100644 --- a/pkg/cmark/cmark.c +++ b/pkg/cmark/cmark.c @@ -1,5 +1,5 @@ -// Code generated by ../../scripts/copy-lib ../../cmark-src at 5ba25ff40eba44c811f79ab6a792baf945b8307c DO NOT EDIT. -// See ../../cmark-src/COPYING for license +// Code generated by ../../scripts/copy-lib ../../cmark-src/ at +8fbf029685482827828b5858444157052f1b0a5f DO NOT EDIT. +// See ../../cmark-src//COPYING for license #include #include #include diff --git a/pkg/cmark/cmark.h b/pkg/cmark/cmark.h index dfed11d..f894623 100644 --- a/pkg/cmark/cmark.h +++ b/pkg/cmark/cmark.h @@ -1,5 +1,5 @@ -// Code generated by ../../scripts/copy-lib ../../cmark-src at 5ba25ff40eba44c811f79ab6a792baf945b8307c DO NOT EDIT. -// See ../../cmark-src/COPYING for license +// Code generated by ../../scripts/copy-lib ../../cmark-src/ at +8fbf029685482827828b5858444157052f1b0a5f DO NOT EDIT. +// See ../../cmark-src//COPYING for license #ifndef CMARK_H #define CMARK_H @@ -469,10 +469,42 @@ CMARK_EXPORT cmark_parser *cmark_parser_new(int options); /** Creates a new parser object with the given memory allocator + * + * A generalization of `cmark_parser_new`: + * ```c + * cmark_parser_new(options) + * ``` + * is the same as: + * ```c + * cmark_parser_new_with_mem(options, cmark_get_default_mem_allocator()) + * ``` */ CMARK_EXPORT cmark_parser *cmark_parser_new_with_mem(int options, cmark_mem *mem); +/** Creates a new parser object with the given node to use as the root + * node of the parsed AST. + * + * When parsing, children are always appended, not prepended; that means + * if `root` already has children, the newly-parsed children will appear + * after the given children. + * + * A generalization of `cmark_parser_new_with_mem`: + * ```c + * cmark_parser_new_with_mem(options, mem) + * ``` + * is approximately the same as: + * ```c + * cmark_parser_new_with_mem_into_root(options, mem, cmark_node_new(CMARK_NODE_DOCUMENT)) + * ``` + * + * This is useful for creating a single document out of multiple parsed + * document fragments. + */ +CMARK_EXPORT +cmark_parser *cmark_parser_new_with_mem_into_root( + int options, cmark_mem *mem, cmark_node *root); + /** Frees memory allocated for a parser object. */ CMARK_EXPORT @@ -589,7 +621,7 @@ char *cmark_render_latex(cmark_node *root, int options, int width); */ #define CMARK_OPT_VALIDATE_UTF8 (1 << 9) -/** Convert straight quotes to curly, --- to em dashes, -- to en dashes. +/** Convert straight quotes to curly, `---` to em dashes, `--` to en dashes. */ #define CMARK_OPT_SMART (1 << 10) diff --git a/pkg/cmark/cmark_ctype.c b/pkg/cmark/cmark_ctype.c index 14829b0..16b41fc 100644 --- a/pkg/cmark/cmark_ctype.c +++ b/pkg/cmark/cmark_ctype.c @@ -1,5 +1,5 @@ -// Code generated by ../../scripts/copy-lib ../../cmark-src at 5ba25ff40eba44c811f79ab6a792baf945b8307c DO NOT EDIT. -// See ../../cmark-src/COPYING for license +// Code generated by ../../scripts/copy-lib ../../cmark-src/ at +8fbf029685482827828b5858444157052f1b0a5f DO NOT EDIT. +// See ../../cmark-src//COPYING for license #include #include "cmark_ctype.h" diff --git a/pkg/cmark/cmark_ctype.h b/pkg/cmark/cmark_ctype.h index c44b97b..601df7c 100644 --- a/pkg/cmark/cmark_ctype.h +++ b/pkg/cmark/cmark_ctype.h @@ -1,5 +1,5 @@ -// Code generated by ../../scripts/copy-lib ../../cmark-src at 5ba25ff40eba44c811f79ab6a792baf945b8307c DO NOT EDIT. -// See ../../cmark-src/COPYING for license +// Code generated by ../../scripts/copy-lib ../../cmark-src/ at +8fbf029685482827828b5858444157052f1b0a5f DO NOT EDIT. +// See ../../cmark-src//COPYING for license #ifndef CMARK_CMARK_CTYPE_H #define CMARK_CMARK_CTYPE_H diff --git a/pkg/cmark/cmark_export.h b/pkg/cmark/cmark_export.h index 678ebe8..51b8d77 100644 --- a/pkg/cmark/cmark_export.h +++ b/pkg/cmark/cmark_export.h @@ -1,5 +1,5 @@ -// Code generated by ../../scripts/copy-lib ../../cmark-src at 5ba25ff40eba44c811f79ab6a792baf945b8307c DO NOT EDIT. -// See ../../cmark-src/COPYING for license +// Code generated by ../../scripts/copy-lib ../../cmark-src/ at +8fbf029685482827828b5858444157052f1b0a5f DO NOT EDIT. +// See ../../cmark-src//COPYING for license #ifndef CMARK_EXPORT_H #define CMARK_EXPORT_H diff --git a/pkg/cmark/cmark_version.h b/pkg/cmark/cmark_version.h index 3a6b037..a09d6e5 100644 --- a/pkg/cmark/cmark_version.h +++ b/pkg/cmark/cmark_version.h @@ -1,5 +1,5 @@ -// Code generated by ../../scripts/copy-lib ../../cmark-src at 5ba25ff40eba44c811f79ab6a792baf945b8307c DO NOT EDIT. -// See ../../cmark-src/COPYING for license +// Code generated by ../../scripts/copy-lib ../../cmark-src/ at +8fbf029685482827828b5858444157052f1b0a5f DO NOT EDIT. +// See ../../cmark-src//COPYING for license #ifndef CMARK_VERSION_H #define CMARK_VERSION_H diff --git a/pkg/cmark/commonmark.c b/pkg/cmark/commonmark.c index ca8181b..67bebc1 100644 --- a/pkg/cmark/commonmark.c +++ b/pkg/cmark/commonmark.c @@ -1,12 +1,12 @@ -// Code generated by ../../scripts/copy-lib ../../cmark-src at 5ba25ff40eba44c811f79ab6a792baf945b8307c DO NOT EDIT. -// See ../../cmark-src/COPYING for license -#include +// Code generated by ../../scripts/copy-lib ../../cmark-src/ at +8fbf029685482827828b5858444157052f1b0a5f DO NOT EDIT. +// See ../../cmark-src//COPYING for license +#include +#include +#include #include +#include #include -#include -#include -#include "config.h" #include "cmark.h" #include "node.h" #include "buffer.h" @@ -23,8 +23,8 @@ // Functions to convert cmark_nodes to commonmark strings. -static CMARK_INLINE void outc(cmark_renderer *renderer, cmark_escaping escape, - int32_t c, unsigned char nextc) { +static inline void outc(cmark_renderer *renderer, cmark_escaping escape, + int32_t c, unsigned char nextc) { bool needs_escaping = false; bool follows_digit = renderer->buffer->size > 0 && @@ -37,7 +37,8 @@ static CMARK_INLINE void outc(cmark_renderer *renderer, cmark_escaping escape, ((escape == NORMAL && (c < 0x20 || c == '*' || c == '_' || c == '[' || c == ']' || c == '#' || c == '<' || - c == '>' || c == '\\' || c == '`' || c == '!' || + c == '>' || c == '\\' || c == '`' || + (c == '!' && (!nextc || nextc == '[')) || (c == '&' && cmark_isalpha(nextc)) || (c == '!' && nextc == '[') || ((CMARK_OPT_SMART & options) && ((c == '-' && nextc == '-') || @@ -67,7 +68,7 @@ static CMARK_INLINE void outc(cmark_renderer *renderer, cmark_escaping escape, } else { // render as entity snprintf(encoded, ENCODED_SIZE, "&#%d;", c); cmark_strbuf_puts(renderer->buffer, encoded); - renderer->column += strlen(encoded); + renderer->column += (int)strlen(encoded); } } else { cmark_render_code_point(renderer, c); @@ -230,7 +231,7 @@ static int S_render_node(cmark_renderer *renderer, cmark_node *node, snprintf(listmarker, LISTMARKER_SIZE, "%d%s%s", list_number, list_delim == CMARK_PAREN_DELIM ? ")" : ".", list_number < 10 ? " " : " "); - marker_width = strlen(listmarker); + marker_width = (bufsize_t)strlen(listmarker); } if (entering) { if (cmark_node_get_list_type(node->parent) == CMARK_BULLET_LIST) { diff --git a/pkg/cmark/config.h b/pkg/cmark/config.h index 163d757..1366bca 100644 --- a/pkg/cmark/config.h +++ b/pkg/cmark/config.h @@ -1,5 +1,5 @@ -// Code generated by ../../scripts/copy-lib ../../cmark-src at 5ba25ff40eba44c811f79ab6a792baf945b8307c DO NOT EDIT. -// See ../../cmark-src/COPYING for license +// Code generated by ../../scripts/copy-lib ../../cmark-src/ at +8fbf029685482827828b5858444157052f1b0a5f DO NOT EDIT. +// See ../../cmark-src//COPYING for license #ifndef CMARK_CONFIG_H #define CMARK_CONFIG_H diff --git a/pkg/cmark/entities.inc b/pkg/cmark/entities.inc index 928246f..94dfc41 100644 --- a/pkg/cmark/entities.inc +++ b/pkg/cmark/entities.inc @@ -1,5 +1,5 @@ -// Code generated by ../../scripts/copy-lib ../../cmark-src at 5ba25ff40eba44c811f79ab6a792baf945b8307c DO NOT EDIT. -// See ../../cmark-src/COPYING for license +// Code generated by ../../scripts/copy-lib ../../cmark-src/ at +8fbf029685482827828b5858444157052f1b0a5f DO NOT EDIT. +// See ../../cmark-src//COPYING for license /* Autogenerated by tools/make_headers_inc.py */ struct cmark_entity_node { diff --git a/pkg/cmark/houdini.h b/pkg/cmark/houdini.h index b443587..c5757f6 100644 --- a/pkg/cmark/houdini.h +++ b/pkg/cmark/houdini.h @@ -1,5 +1,5 @@ -// Code generated by ../../scripts/copy-lib ../../cmark-src at 5ba25ff40eba44c811f79ab6a792baf945b8307c DO NOT EDIT. -// See ../../cmark-src/COPYING for license +// Code generated by ../../scripts/copy-lib ../../cmark-src/ at +8fbf029685482827828b5858444157052f1b0a5f DO NOT EDIT. +// See ../../cmark-src//COPYING for license #ifndef CMARK_HOUDINI_H #define CMARK_HOUDINI_H @@ -8,16 +8,8 @@ extern "C" { #endif #include -#include "config.h" -#include "buffer.h" -#ifdef HAVE___BUILTIN_EXPECT -#define likely(x) __builtin_expect((x), 1) -#define unlikely(x) __builtin_expect((x), 0) -#else -#define likely(x) (x) -#define unlikely(x) (x) -#endif +#include "buffer.h" #ifdef HOUDINI_USE_LOCALE #define _isxdigit(c) isxdigit(c) diff --git a/pkg/cmark/houdini_href_e.c b/pkg/cmark/houdini_href_e.c index aac8922..207ac42 100644 --- a/pkg/cmark/houdini_href_e.c +++ b/pkg/cmark/houdini_href_e.c @@ -1,11 +1,22 @@ -// Code generated by ../../scripts/copy-lib ../../cmark-src at 5ba25ff40eba44c811f79ab6a792baf945b8307c DO NOT EDIT. -// See ../../cmark-src/COPYING for license +// Code generated by ../../scripts/copy-lib ../../cmark-src/ at +8fbf029685482827828b5858444157052f1b0a5f DO NOT EDIT. +// See ../../cmark-src//COPYING for license #include #include #include #include "houdini.h" +#if !defined(__has_builtin) +# define __has_builtin(b) 0 +#endif + +#if !__has_builtin(__builtin_expect) +# define __builtin_expect(e, v) (e) +#endif + +#define likely(e) __builtin_expect((e), 1) +#define unlikely(e) __builtin_expect((e), 0) + /* * The following characters will not be escaped: * diff --git a/pkg/cmark/houdini_html_e.c b/pkg/cmark/houdini_html_e.c index 002f2bc..1aab8d4 100644 --- a/pkg/cmark/houdini_html_e.c +++ b/pkg/cmark/houdini_html_e.c @@ -1,11 +1,22 @@ -// Code generated by ../../scripts/copy-lib ../../cmark-src at 5ba25ff40eba44c811f79ab6a792baf945b8307c DO NOT EDIT. -// See ../../cmark-src/COPYING for license +// Code generated by ../../scripts/copy-lib ../../cmark-src/ at +8fbf029685482827828b5858444157052f1b0a5f DO NOT EDIT. +// See ../../cmark-src//COPYING for license #include #include #include #include "houdini.h" +#if !defined(__has_builtin) +# define __has_builtin(b) 0 +#endif + +#if !__has_builtin(__builtin_expect) +# define __builtin_expect(e, v) (e) +#endif + +#define likely(e) __builtin_expect((e), 1) +#define unlikely(e) __builtin_expect((e), 0) + /** * According to the OWASP rules: * diff --git a/pkg/cmark/houdini_html_u.c b/pkg/cmark/houdini_html_u.c index 17a1b01..d9d4107 100644 --- a/pkg/cmark/houdini_html_u.c +++ b/pkg/cmark/houdini_html_u.c @@ -1,5 +1,5 @@ -// Code generated by ../../scripts/copy-lib ../../cmark-src at 5ba25ff40eba44c811f79ab6a792baf945b8307c DO NOT EDIT. -// See ../../cmark-src/COPYING for license +// Code generated by ../../scripts/copy-lib ../../cmark-src/ at +8fbf029685482827828b5858444157052f1b0a5f DO NOT EDIT. +// See ../../cmark-src//COPYING for license #include #include #include @@ -9,6 +9,17 @@ #include "utf8.h" #include "entities.inc" +#if !defined(__has_builtin) +# define __has_builtin(b) 0 +#endif + +#if !__has_builtin(__builtin_expect) +# define __builtin_expect(e, v) (e) +#endif + +#define likely(e) __builtin_expect((e), 1) +#define unlikely(e) __builtin_expect((e), 0) + /* Binary tree lookup code for entities added by JGM */ static const unsigned char *S_lookup(int i, int low, int hi, diff --git a/pkg/cmark/html.c b/pkg/cmark/html.c index f07f705..07596fe 100644 --- a/pkg/cmark/html.c +++ b/pkg/cmark/html.c @@ -1,11 +1,12 @@ -// Code generated by ../../scripts/copy-lib ../../cmark-src at 5ba25ff40eba44c811f79ab6a792baf945b8307c DO NOT EDIT. -// See ../../cmark-src/COPYING for license -#include +// Code generated by ../../scripts/copy-lib ../../cmark-src/ at +8fbf029685482827828b5858444157052f1b0a5f DO NOT EDIT. +// See ../../cmark-src//COPYING for license +#include +#include #include +#include #include -#include + #include "cmark_ctype.h" -#include "config.h" #include "cmark.h" #include "node.h" #include "buffer.h" @@ -21,7 +22,7 @@ static void escape_html(cmark_strbuf *dest, const unsigned char *source, houdini_escape_html0(dest, source, length, 0); } -static CMARK_INLINE void cr(cmark_strbuf *html) { +static inline void cr(cmark_strbuf *html) { if (html->size && html->ptr[html->size - 1] != '\n') cmark_strbuf_putc(html, '\n'); } @@ -161,7 +162,10 @@ static int S_render_node(cmark_node *node, cmark_event_type ev_type, cmark_strbuf_puts(html, "as.code.info, "language-", 9) != 0) { + cmark_strbuf_puts(html, "language-"); + } escape_html(html, node->as.code.info, first_tag); cmark_strbuf_puts(html, "\">"); } @@ -281,12 +285,12 @@ static int S_render_node(cmark_node *node, cmark_event_type ev_type, if (node->as.link.url && ((options & CMARK_OPT_UNSAFE) || !(_scan_dangerous_url(node->as.link.url)))) { houdini_escape_href(html, node->as.link.url, - strlen((char *)node->as.link.url)); + (bufsize_t)strlen((char *)node->as.link.url)); } if (node->as.link.title) { cmark_strbuf_puts(html, "\" title=\""); escape_html(html, node->as.link.title, - strlen((char *)node->as.link.title)); + (bufsize_t)strlen((char *)node->as.link.title)); } cmark_strbuf_puts(html, "\">"); } else { @@ -300,7 +304,7 @@ static int S_render_node(cmark_node *node, cmark_event_type ev_type, if (node->as.link.url && ((options & CMARK_OPT_UNSAFE) || !(_scan_dangerous_url(node->as.link.url)))) { houdini_escape_href(html, node->as.link.url, - strlen((char *)node->as.link.url)); + (bufsize_t)strlen((char *)node->as.link.url)); } cmark_strbuf_puts(html, "\" alt=\""); state->plain = node; @@ -308,7 +312,7 @@ static int S_render_node(cmark_node *node, cmark_event_type ev_type, if (node->as.link.title) { cmark_strbuf_puts(html, "\" title=\""); escape_html(html, node->as.link.title, - strlen((char *)node->as.link.title)); + (bufsize_t)strlen((char *)node->as.link.title)); } cmark_strbuf_puts(html, "\" />"); diff --git a/pkg/cmark/inlines.c b/pkg/cmark/inlines.c index a163d38..1b7207b 100644 --- a/pkg/cmark/inlines.c +++ b/pkg/cmark/inlines.c @@ -1,11 +1,11 @@ -// Code generated by ../../scripts/copy-lib ../../cmark-src at 5ba25ff40eba44c811f79ab6a792baf945b8307c DO NOT EDIT. -// See ../../cmark-src/COPYING for license +// Code generated by ../../scripts/copy-lib ../../cmark-src/ at +8fbf029685482827828b5858444157052f1b0a5f DO NOT EDIT. +// See ../../cmark-src//COPYING for license +#include +#include #include #include -#include #include "cmark_ctype.h" -#include "config.h" #include "node.h" #include "parser.h" #include "references.h" @@ -72,7 +72,7 @@ typedef struct { bool no_link_openers; } subject; -static CMARK_INLINE bool S_is_line_end_char(char c) { +static inline bool S_is_line_end_char(char c) { return (c == '\n' || c == '\r'); } @@ -86,8 +86,8 @@ static void subject_from_buf(cmark_mem *mem, int line_number, int block_offset, static bufsize_t subject_find_special_char(subject *subj, int options); // Create an inline with a literal string value. -static CMARK_INLINE cmark_node *make_literal(subject *subj, cmark_node_type t, - int start_column, int end_column) { +static inline cmark_node *make_literal(subject *subj, cmark_node_type t, + int start_column, int end_column) { cmark_node *e = (cmark_node *)subj->mem->calloc(1, sizeof(*e)); e->mem = subj->mem; e->type = (uint16_t)t; @@ -99,7 +99,7 @@ static CMARK_INLINE cmark_node *make_literal(subject *subj, cmark_node_type t, } // Create an inline with no value. -static CMARK_INLINE cmark_node *make_simple(cmark_mem *mem, cmark_node_type t) { +static inline cmark_node *make_simple(cmark_mem *mem, cmark_node_type t) { cmark_node *e = (cmark_node *)mem->calloc(1, sizeof(*e)); e->mem = mem; e->type = t; @@ -181,9 +181,9 @@ static unsigned char *cmark_clean_autolink(cmark_mem *mem, cmark_chunk *url, return cmark_strbuf_detach(&buf); } -static CMARK_INLINE cmark_node *make_autolink(subject *subj, - int start_column, int end_column, - cmark_chunk url, int is_email) { +static inline cmark_node *make_autolink(subject *subj, int start_column, + int end_column, cmark_chunk url, + int is_email) { cmark_node *link = make_simple(subj->mem, CMARK_NODE_LINK); link->as.link.url = cmark_clean_autolink(subj->mem, &url, is_email); link->as.link.title = NULL; @@ -214,28 +214,28 @@ static void subject_from_buf(cmark_mem *mem, int line_number, int block_offset, e->no_link_openers = true; } -static CMARK_INLINE int isbacktick(int c) { return (c == '`'); } +static inline int isbacktick(int c) { return (c == '`'); } -static CMARK_INLINE unsigned char peek_char(subject *subj) { +static 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 CMARK_INLINE unsigned char peek_at(subject *subj, bufsize_t pos) { +static 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 CMARK_INLINE int is_eof(subject *subj) { +static 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 CMARK_INLINE bool skip_spaces(subject *subj) { +static inline bool skip_spaces(subject *subj) { bool skipped = false; while (peek_char(subj) == ' ' || peek_char(subj) == '\t') { advance(subj); @@ -244,7 +244,7 @@ static CMARK_INLINE bool skip_spaces(subject *subj) { return skipped; } -static CMARK_INLINE bool skip_line_end(subject *subj) { +static inline bool skip_line_end(subject *subj) { bool seen_line_end_char = false; if (peek_char(subj) == '\r') { advance(subj); @@ -258,7 +258,7 @@ static CMARK_INLINE bool skip_line_end(subject *subj) { } // Take characters while a predicate holds, and return a string. -static CMARK_INLINE cmark_chunk take_while(subject *subj, int (*f)(int)) { +static inline cmark_chunk take_while(subject *subj, int (*f)(int)) { unsigned char c; bufsize_t startpos = subj->pos; bufsize_t len = 0; @@ -464,18 +464,20 @@ static int scan_delims(subject *subj, unsigned char c, bool *can_open, after_char = 10; } left_flanking = numdelims > 0 && !cmark_utf8proc_is_space(after_char) && - (!cmark_utf8proc_is_punctuation(after_char) || + (!cmark_utf8proc_is_punctuation_or_symbol(after_char) || cmark_utf8proc_is_space(before_char) || - cmark_utf8proc_is_punctuation(before_char)); + cmark_utf8proc_is_punctuation_or_symbol(before_char)); right_flanking = numdelims > 0 && !cmark_utf8proc_is_space(before_char) && - (!cmark_utf8proc_is_punctuation(before_char) || + (!cmark_utf8proc_is_punctuation_or_symbol(before_char) || cmark_utf8proc_is_space(after_char) || - cmark_utf8proc_is_punctuation(after_char)); + cmark_utf8proc_is_punctuation_or_symbol(after_char)); if (c == '_') { *can_open = left_flanking && - (!right_flanking || cmark_utf8proc_is_punctuation(before_char)); + (!right_flanking || + cmark_utf8proc_is_punctuation_or_symbol(before_char)); *can_close = right_flanking && - (!left_flanking || cmark_utf8proc_is_punctuation(after_char)); + (!left_flanking || + cmark_utf8proc_is_punctuation_or_symbol(after_char)); } else if (c == '\'' || c == '"') { *can_open = left_flanking && (!right_flanking || before_char == '(' || before_char == '[') && @@ -655,9 +657,11 @@ static void process_emphasis(subject *subj, bufsize_t stack_bottom) { delimiter *old_closer; bool opener_found; int openers_bottom_index = 0; - bufsize_t openers_bottom[9] = {stack_bottom, stack_bottom, stack_bottom, - stack_bottom, stack_bottom, stack_bottom, - stack_bottom, stack_bottom, stack_bottom}; + bufsize_t openers_bottom[15] = {stack_bottom, stack_bottom, stack_bottom, + stack_bottom, stack_bottom, stack_bottom, + stack_bottom, stack_bottom, stack_bottom, + stack_bottom, stack_bottom, stack_bottom, + stack_bottom, stack_bottom, stack_bottom}; // move back to first relevant delim. candidate = subj->last_delim; @@ -677,10 +681,11 @@ static void process_emphasis(subject *subj, bufsize_t stack_bottom) { openers_bottom_index = 1; break; case '_': - openers_bottom_index = 2; + openers_bottom_index = 2 + + (closer->can_open ? 3 : 0) + (closer->length % 3); break; case '*': - openers_bottom_index = 3 + + openers_bottom_index = 8 + (closer->can_open ? 3 : 0) + (closer->length % 3); break; default: @@ -783,13 +788,26 @@ static delimiter *S_insert_emph(subject *subj, delimiter *opener, emph = use_delims == 1 ? make_emph(subj->mem) : make_strong(subj->mem); tmp = opener_inl->next; - while (tmp && tmp != closer_inl) { - tmpnext = tmp->next; - cmark_node_unlink(tmp); - append_child(emph, tmp); - tmp = tmpnext; + if (tmp && tmp != closer_inl) { + emph->first_child = tmp; + tmp->prev = NULL; + + while (tmp && tmp != closer_inl) { + tmpnext = tmp->next; + tmp->parent = emph; + if (tmpnext == closer_inl) { + emph->last_child = tmp; + tmp->next = NULL; + } + tmp = tmpnext; + } } - cmark_node_insert_after(opener_inl, emph); + + opener_inl->next = emph; + closer_inl->prev = emph; + emph->prev = opener_inl; + emph->next = closer_inl; + emph->parent = opener_inl->parent; emph->start_line = opener_inl->start_line; emph->end_line = closer_inl->end_line; @@ -1180,7 +1198,7 @@ static cmark_node *handle_close_bracket(subject *subj) { found_label = link_label(subj, &raw_label); if (!found_label) { // If we have a shortcut reference link, back up - // to before the spacse we skipped. + // to before the spaces we skipped. subj->pos = initial_pos; } diff --git a/pkg/cmark/inlines.h b/pkg/cmark/inlines.h index 04cfbf9..3e5beab 100644 --- a/pkg/cmark/inlines.h +++ b/pkg/cmark/inlines.h @@ -1,5 +1,5 @@ -// Code generated by ../../scripts/copy-lib ../../cmark-src at 5ba25ff40eba44c811f79ab6a792baf945b8307c DO NOT EDIT. -// See ../../cmark-src/COPYING for license +// Code generated by ../../scripts/copy-lib ../../cmark-src/ at +8fbf029685482827828b5858444157052f1b0a5f DO NOT EDIT. +// See ../../cmark-src//COPYING for license #ifndef CMARK_INLINES_H #define CMARK_INLINES_H diff --git a/pkg/cmark/iterator.c b/pkg/cmark/iterator.c index 0020bd5..90a556a 100644 --- a/pkg/cmark/iterator.c +++ b/pkg/cmark/iterator.c @@ -1,9 +1,9 @@ -// Code generated by ../../scripts/copy-lib ../../cmark-src at 5ba25ff40eba44c811f79ab6a792baf945b8307c DO NOT EDIT. -// See ../../cmark-src/COPYING for license +// Code generated by ../../scripts/copy-lib ../../cmark-src/ at +8fbf029685482827828b5858444157052f1b0a5f DO NOT EDIT. +// See ../../cmark-src//COPYING for license #include +#include #include -#include "config.h" #include "node.h" #include "cmark.h" #include "iterator.h" diff --git a/pkg/cmark/iterator.h b/pkg/cmark/iterator.h index 7d62be5..f5e275f 100644 --- a/pkg/cmark/iterator.h +++ b/pkg/cmark/iterator.h @@ -1,5 +1,5 @@ -// Code generated by ../../scripts/copy-lib ../../cmark-src at 5ba25ff40eba44c811f79ab6a792baf945b8307c DO NOT EDIT. -// See ../../cmark-src/COPYING for license +// Code generated by ../../scripts/copy-lib ../../cmark-src/ at +8fbf029685482827828b5858444157052f1b0a5f DO NOT EDIT. +// See ../../cmark-src//COPYING for license #ifndef CMARK_ITERATOR_H #define CMARK_ITERATOR_H diff --git a/pkg/cmark/latex.c b/pkg/cmark/latex.c index 5afe0b2..8feab21 100644 --- a/pkg/cmark/latex.c +++ b/pkg/cmark/latex.c @@ -1,11 +1,11 @@ -// Code generated by ../../scripts/copy-lib ../../cmark-src at 5ba25ff40eba44c811f79ab6a792baf945b8307c DO NOT EDIT. -// See ../../cmark-src/COPYING for license -#include +// Code generated by ../../scripts/copy-lib ../../cmark-src/ at +8fbf029685482827828b5858444157052f1b0a5f DO NOT EDIT. +// See ../../cmark-src//COPYING for license +#include +#include #include +#include #include -#include -#include "config.h" #include "cmark.h" #include "node.h" #include "buffer.h" @@ -19,8 +19,8 @@ #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) { +static inline void outc(cmark_renderer *renderer, cmark_escaping escape, + int32_t c, unsigned char nextc) { if (escape == LITERAL) { cmark_render_code_point(renderer, c); return; diff --git a/pkg/cmark/man.c b/pkg/cmark/man.c index 59d296a..fc7993e 100644 --- a/pkg/cmark/man.c +++ b/pkg/cmark/man.c @@ -1,11 +1,11 @@ -// Code generated by ../../scripts/copy-lib ../../cmark-src at 5ba25ff40eba44c811f79ab6a792baf945b8307c DO NOT EDIT. -// See ../../cmark-src/COPYING for license -#include +// Code generated by ../../scripts/copy-lib ../../cmark-src/ at +8fbf029685482827828b5858444157052f1b0a5f DO NOT EDIT. +// See ../../cmark-src//COPYING for license +#include +#include #include +#include #include -#include -#include "config.h" #include "cmark.h" #include "node.h" #include "buffer.h" diff --git a/pkg/cmark/node.c b/pkg/cmark/node.c index 23d8e7a..717d484 100644 --- a/pkg/cmark/node.c +++ b/pkg/cmark/node.c @@ -1,14 +1,14 @@ -// Code generated by ../../scripts/copy-lib ../../cmark-src at 5ba25ff40eba44c811f79ab6a792baf945b8307c DO NOT EDIT. -// See ../../cmark-src/COPYING for license +// Code generated by ../../scripts/copy-lib ../../cmark-src/ at +8fbf029685482827828b5858444157052f1b0a5f DO NOT EDIT. +// See ../../cmark-src//COPYING for license +#include #include #include -#include "config.h" #include "node.h" static void S_node_unlink(cmark_node *node); -static CMARK_INLINE bool S_is_block(cmark_node *node) { +static inline bool S_is_block(cmark_node *node) { if (node == NULL) { return false; } @@ -16,7 +16,7 @@ static CMARK_INLINE bool S_is_block(cmark_node *node) { node->type <= CMARK_NODE_LAST_BLOCK; } -static CMARK_INLINE bool S_is_inline(cmark_node *node) { +static inline bool S_is_inline(cmark_node *node) { if (node == NULL) { return false; } diff --git a/pkg/cmark/node.h b/pkg/cmark/node.h index 80e06cb..f50a444 100644 --- a/pkg/cmark/node.h +++ b/pkg/cmark/node.h @@ -1,5 +1,5 @@ -// Code generated by ../../scripts/copy-lib ../../cmark-src at 5ba25ff40eba44c811f79ab6a792baf945b8307c DO NOT EDIT. -// See ../../cmark-src/COPYING for license +// Code generated by ../../scripts/copy-lib ../../cmark-src/ at +8fbf029685482827828b5858444157052f1b0a5f DO NOT EDIT. +// See ../../cmark-src//COPYING for license #ifndef CMARK_NODE_H #define CMARK_NODE_H @@ -7,10 +7,10 @@ extern "C" { #endif -#include +#include #include +#include -#include "config.h" #include "cmark.h" #include "buffer.h" @@ -52,6 +52,7 @@ enum cmark_node__internal_flags { CMARK_NODE__OPEN = (1 << 0), CMARK_NODE__LAST_LINE_BLANK = (1 << 1), CMARK_NODE__LAST_LINE_CHECKED = (1 << 2), + CMARK_NODE__LIST_LAST_LINE_BLANK = (1 << 3), }; struct cmark_node { diff --git a/pkg/cmark/parser.h b/pkg/cmark/parser.h index 8d0a200..7ae2e7a 100644 --- a/pkg/cmark/parser.h +++ b/pkg/cmark/parser.h @@ -1,5 +1,5 @@ -// Code generated by ../../scripts/copy-lib ../../cmark-src at 5ba25ff40eba44c811f79ab6a792baf945b8307c DO NOT EDIT. -// See ../../cmark-src/COPYING for license +// Code generated by ../../scripts/copy-lib ../../cmark-src/ at +8fbf029685482827828b5858444157052f1b0a5f DO NOT EDIT. +// See ../../cmark-src//COPYING for license #ifndef CMARK_AST_H #define CMARK_AST_H diff --git a/pkg/cmark/references.c b/pkg/cmark/references.c index eb8d577..fb01564 100644 --- a/pkg/cmark/references.c +++ b/pkg/cmark/references.c @@ -1,5 +1,5 @@ -// Code generated by ../../scripts/copy-lib ../../cmark-src at 5ba25ff40eba44c811f79ab6a792baf945b8307c DO NOT EDIT. -// See ../../cmark-src/COPYING for license +// Code generated by ../../scripts/copy-lib ../../cmark-src/ at +8fbf029685482827828b5858444157052f1b0a5f DO NOT EDIT. +// See ../../cmark-src//COPYING for license #include "cmark.h" #include "utf8.h" #include "parser.h" @@ -65,9 +65,9 @@ void cmark_reference_create(cmark_reference_map *map, cmark_chunk *label, ref->next = map->refs; if (ref->url != NULL) - ref->size += strlen((char*)ref->url); + ref->size += (int)strlen((char*)ref->url); if (ref->title != NULL) - ref->size += strlen((char*)ref->title); + ref->size += (int)strlen((char*)ref->title); map->refs = ref; map->size++; diff --git a/pkg/cmark/references.h b/pkg/cmark/references.h index 2abc71a..234fd5d 100644 --- a/pkg/cmark/references.h +++ b/pkg/cmark/references.h @@ -1,5 +1,5 @@ -// Code generated by ../../scripts/copy-lib ../../cmark-src at 5ba25ff40eba44c811f79ab6a792baf945b8307c DO NOT EDIT. -// See ../../cmark-src/COPYING for license +// Code generated by ../../scripts/copy-lib ../../cmark-src/ at +8fbf029685482827828b5858444157052f1b0a5f DO NOT EDIT. +// See ../../cmark-src//COPYING for license #ifndef CMARK_REFERENCES_H #define CMARK_REFERENCES_H diff --git a/pkg/cmark/render.c b/pkg/cmark/render.c index abe6859..eb6ba9e 100644 --- a/pkg/cmark/render.c +++ b/pkg/cmark/render.c @@ -1,5 +1,5 @@ -// Code generated by ../../scripts/copy-lib ../../cmark-src at 5ba25ff40eba44c811f79ab6a792baf945b8307c DO NOT EDIT. -// See ../../cmark-src/COPYING for license +// Code generated by ../../scripts/copy-lib ../../cmark-src/ at +8fbf029685482827828b5858444157052f1b0a5f DO NOT EDIT. +// See ../../cmark-src//COPYING for license #include #include "buffer.h" #include "cmark.h" @@ -8,13 +8,13 @@ #include "node.h" #include "cmark_ctype.h" -static CMARK_INLINE void S_cr(cmark_renderer *renderer) { +static inline void S_cr(cmark_renderer *renderer) { if (renderer->need_cr < 1) { renderer->need_cr = 1; } } -static CMARK_INLINE void S_blankline(cmark_renderer *renderer) { +static inline void S_blankline(cmark_renderer *renderer) { if (renderer->need_cr < 2) { renderer->need_cr = 2; } @@ -22,7 +22,7 @@ static CMARK_INLINE void S_blankline(cmark_renderer *renderer) { static void S_out(cmark_renderer *renderer, const char *source, bool wrap, cmark_escaping escape) { - int length = strlen(source); + int length = (int)strlen(source); unsigned char nextc; int32_t c; int i = 0; diff --git a/pkg/cmark/render.h b/pkg/cmark/render.h index a38a4d2..7fc1bc2 100644 --- a/pkg/cmark/render.h +++ b/pkg/cmark/render.h @@ -1,5 +1,5 @@ -// Code generated by ../../scripts/copy-lib ../../cmark-src at 5ba25ff40eba44c811f79ab6a792baf945b8307c DO NOT EDIT. -// See ../../cmark-src/COPYING for license +// Code generated by ../../scripts/copy-lib ../../cmark-src/ at +8fbf029685482827828b5858444157052f1b0a5f DO NOT EDIT. +// See ../../cmark-src//COPYING for license #ifndef CMARK_RENDER_H #define CMARK_RENDER_H @@ -7,7 +7,9 @@ extern "C" { #endif +#include #include + #include "buffer.h" typedef enum { LITERAL, NORMAL, TITLE, URL } cmark_escaping; diff --git a/pkg/cmark/scanners.c b/pkg/cmark/scanners.c index 1326bfc..f705264 100644 --- a/pkg/cmark/scanners.c +++ b/pkg/cmark/scanners.c @@ -1,5 +1,5 @@ -// Code generated by ../../scripts/copy-lib ../../cmark-src at 5ba25ff40eba44c811f79ab6a792baf945b8307c DO NOT EDIT. -// See ../../cmark-src/COPYING for license +// Code generated by ../../scripts/copy-lib ../../cmark-src/ at +8fbf029685482827828b5858444157052f1b0a5f DO NOT EDIT. +// See ../../cmark-src//COPYING for license /* Generated by re2c 3.0 */ #include #include "chunk.h" diff --git a/pkg/cmark/scanners.h b/pkg/cmark/scanners.h index 36da439..92b56e7 100644 --- a/pkg/cmark/scanners.h +++ b/pkg/cmark/scanners.h @@ -1,5 +1,5 @@ -// Code generated by ../../scripts/copy-lib ../../cmark-src at 5ba25ff40eba44c811f79ab6a792baf945b8307c DO NOT EDIT. -// See ../../cmark-src/COPYING for license +// Code generated by ../../scripts/copy-lib ../../cmark-src/ at +8fbf029685482827828b5858444157052f1b0a5f DO NOT EDIT. +// See ../../cmark-src//COPYING for license #include "cmark.h" #include "chunk.h" diff --git a/pkg/cmark/utf8.c b/pkg/cmark/utf8.c index 99bbf8c..0e3fb8e 100644 --- a/pkg/cmark/utf8.c +++ b/pkg/cmark/utf8.c @@ -1,5 +1,5 @@ -// Code generated by ../../scripts/copy-lib ../../cmark-src at 5ba25ff40eba44c811f79ab6a792baf945b8307c DO NOT EDIT. -// See ../../cmark-src/COPYING for license +// Code generated by ../../scripts/copy-lib ../../cmark-src/ at +8fbf029685482827828b5858444157052f1b0a5f DO NOT EDIT. +// See ../../cmark-src//COPYING for license #include #include #include @@ -254,10 +254,13 @@ int cmark_utf8proc_is_space(int32_t uc) { uc == 8287 || uc == 12288); } -// matches anything in the P[cdefios] classes. +// matches anything in the P[cdefios] classe. int cmark_utf8proc_is_punctuation(int32_t uc) { - return ( - (uc < 128 && cmark_ispunct((char)uc)) || uc == 161 || uc == 167 || + if (uc < 128) { + return cmark_ispunct((char)uc); + } else { + return + (uc == 161 || uc == 167 || uc == 171 || uc == 182 || uc == 183 || uc == 187 || uc == 191 || uc == 894 || uc == 903 || (uc >= 1370 && uc <= 1375) || uc == 1417 || uc == 1418 || uc == 1470 || uc == 1472 || uc == 1475 || uc == 1478 || @@ -316,4 +319,164 @@ int cmark_utf8proc_is_punctuation(int32_t uc) { (uc >= 74864 && uc <= 74868) || uc == 92782 || uc == 92783 || uc == 92917 || (uc >= 92983 && uc <= 92987) || uc == 92996 || uc == 113823); + } +} + +// matches anything in the P or S classes. +int cmark_utf8proc_is_punctuation_or_symbol(int32_t uc) { + if (uc < 128) { + return cmark_ispunct((char)uc); + } else { + return ( + uc > 128 && + ((uc >= 161 && uc <= 169) || (uc >= 171 && uc <= 172) || + (uc >= 174 && uc <= 177) || (uc == 180) || (uc >= 182 && uc <= 184) || + (uc == 187) || (uc == 191) || (uc == 215) || (uc == 247) || + (uc >= 706 && uc <= 709) || (uc >= 722 && uc <= 735) || + (uc >= 741 && uc <= 747) || (uc == 749) || (uc >= 751 && uc <= 767) || + (uc == 885) || (uc == 894) || (uc >= 900 && uc <= 901) || + (uc == 903) || (uc == 1014) || (uc == 1154) || + (uc >= 1370 && uc <= 1375) || (uc >= 1417 && uc <= 1418) || + (uc >= 1421 && uc <= 1423) || (uc == 1470) || (uc == 1472) || + (uc == 1475) || (uc == 1478) || (uc >= 1523 && uc <= 1524) || + (uc >= 1542 && uc <= 1551) || (uc == 1563) || + (uc >= 1565 && uc <= 1567) || (uc >= 1642 && uc <= 1645) || + (uc == 1748) || (uc == 1758) || (uc == 1769) || + (uc >= 1789 && uc <= 1790) || (uc >= 1792 && uc <= 1805) || + (uc >= 2038 && uc <= 2041) || (uc >= 2046 && uc <= 2047) || + (uc >= 2096 && uc <= 2110) || (uc == 2142) || (uc == 2184) || + (uc >= 2404 && uc <= 2405) || (uc == 2416) || + (uc >= 2546 && uc <= 2547) || (uc >= 2554 && uc <= 2555) || + (uc == 2557) || (uc == 2678) || (uc >= 2800 && uc <= 2801) || + (uc == 2928) || (uc >= 3059 && uc <= 3066) || (uc == 3191) || + (uc == 3199) || (uc == 3204) || (uc == 3407) || (uc == 3449) || + (uc == 3572) || (uc == 3647) || (uc == 3663) || + (uc >= 3674 && uc <= 3675) || (uc >= 3841 && uc <= 3863) || + (uc >= 3866 && uc <= 3871) || (uc == 3892) || (uc == 3894) || + (uc == 3896) || (uc >= 3898 && uc <= 3901) || (uc == 3973) || + (uc >= 4030 && uc <= 4037) || (uc >= 4039 && uc <= 4044) || + (uc >= 4046 && uc <= 4058) || (uc >= 4170 && uc <= 4175) || + (uc >= 4254 && uc <= 4255) || (uc == 4347) || + (uc >= 4960 && uc <= 4968) || (uc >= 5008 && uc <= 5017) || + (uc == 5120) || (uc >= 5741 && uc <= 5742) || + (uc >= 5787 && uc <= 5788) || (uc >= 5867 && uc <= 5869) || + (uc >= 5941 && uc <= 5942) || (uc >= 6100 && uc <= 6102) || + (uc >= 6104 && uc <= 6107) || (uc >= 6144 && uc <= 6154) || + (uc == 6464) || (uc >= 6468 && uc <= 6469) || + (uc >= 6622 && uc <= 6655) || (uc >= 6686 && uc <= 6687) || + (uc >= 6816 && uc <= 6822) || (uc >= 6824 && uc <= 6829) || + (uc >= 7002 && uc <= 7018) || (uc >= 7028 && uc <= 7038) || + (uc >= 7164 && uc <= 7167) || (uc >= 7227 && uc <= 7231) || + (uc >= 7294 && uc <= 7295) || (uc >= 7360 && uc <= 7367) || + (uc == 7379) || (uc == 8125) || (uc >= 8127 && uc <= 8129) || + (uc >= 8141 && uc <= 8143) || (uc >= 8157 && uc <= 8159) || + (uc >= 8173 && uc <= 8175) || (uc >= 8189 && uc <= 8190) || + (uc >= 8208 && uc <= 8231) || (uc >= 8240 && uc <= 8286) || + (uc >= 8314 && uc <= 8318) || (uc >= 8330 && uc <= 8334) || + (uc >= 8352 && uc <= 8384) || (uc >= 8448 && uc <= 8449) || + (uc >= 8451 && uc <= 8454) || (uc >= 8456 && uc <= 8457) || + (uc == 8468) || (uc >= 8470 && uc <= 8472) || + (uc >= 8478 && uc <= 8483) || (uc == 8485) || (uc == 8487) || + (uc == 8489) || (uc == 8494) || (uc >= 8506 && uc <= 8507) || + (uc >= 8512 && uc <= 8516) || (uc >= 8522 && uc <= 8525) || + (uc == 8527) || (uc >= 8586 && uc <= 8587) || + (uc >= 8592 && uc <= 9254) || (uc >= 9280 && uc <= 9290) || + (uc >= 9372 && uc <= 9449) || (uc >= 9472 && uc <= 10101) || + (uc >= 10132 && uc <= 11123) || (uc >= 11126 && uc <= 11157) || + (uc >= 11159 && uc <= 11263) || (uc >= 11493 && uc <= 11498) || + (uc >= 11513 && uc <= 11516) || (uc >= 11518 && uc <= 11519) || + (uc == 11632) || (uc >= 11776 && uc <= 11822) || + (uc >= 11824 && uc <= 11869) || (uc >= 11904 && uc <= 11929) || + (uc >= 11931 && uc <= 12019) || (uc >= 12032 && uc <= 12245) || + (uc >= 12272 && uc <= 12283) || (uc >= 12289 && uc <= 12292) || + (uc >= 12296 && uc <= 12320) || (uc == 12336) || + (uc >= 12342 && uc <= 12343) || (uc >= 12349 && uc <= 12351) || + (uc >= 12443 && uc <= 12444) || (uc == 12448) || (uc == 12539) || + (uc >= 12688 && uc <= 12689) || (uc >= 12694 && uc <= 12703) || + (uc >= 12736 && uc <= 12771) || (uc >= 12800 && uc <= 12830) || + (uc >= 12842 && uc <= 12871) || (uc == 12880) || + (uc >= 12896 && uc <= 12927) || (uc >= 12938 && uc <= 12976) || + (uc >= 12992 && uc <= 13311) || (uc >= 19904 && uc <= 19967) || + (uc >= 42128 && uc <= 42182) || (uc >= 42238 && uc <= 42239) || + (uc >= 42509 && uc <= 42511) || (uc == 42611) || (uc == 42622) || + (uc >= 42738 && uc <= 42743) || (uc >= 42752 && uc <= 42774) || + (uc >= 42784 && uc <= 42785) || (uc >= 42889 && uc <= 42890) || + (uc >= 43048 && uc <= 43051) || (uc >= 43062 && uc <= 43065) || + (uc >= 43124 && uc <= 43127) || (uc >= 43214 && uc <= 43215) || + (uc >= 43256 && uc <= 43258) || (uc == 43260) || + (uc >= 43310 && uc <= 43311) || (uc == 43359) || + (uc >= 43457 && uc <= 43469) || (uc >= 43486 && uc <= 43487) || + (uc >= 43612 && uc <= 43615) || (uc >= 43639 && uc <= 43641) || + (uc >= 43742 && uc <= 43743) || (uc >= 43760 && uc <= 43761) || + (uc == 43867) || (uc >= 43882 && uc <= 43883) || (uc == 44011) || + (uc == 64297) || (uc >= 64434 && uc <= 64450) || + (uc >= 64830 && uc <= 64847) || (uc == 64975) || + (uc >= 65020 && uc <= 65023) || (uc >= 65040 && uc <= 65049) || + (uc >= 65072 && uc <= 65106) || (uc >= 65108 && uc <= 65126) || + (uc >= 65128 && uc <= 65131) || (uc >= 65281 && uc <= 65295) || + (uc >= 65306 && uc <= 65312) || (uc >= 65339 && uc <= 65344) || + (uc >= 65371 && uc <= 65381) || (uc >= 65504 && uc <= 65510) || + (uc >= 65512 && uc <= 65518) || (uc >= 65532 && uc <= 65533) || + (uc >= 65792 && uc <= 65794) || (uc >= 65847 && uc <= 65855) || + (uc >= 65913 && uc <= 65929) || (uc >= 65932 && uc <= 65934) || + (uc >= 65936 && uc <= 65948) || (uc == 65952) || + (uc >= 66000 && uc <= 66044) || (uc == 66463) || (uc == 66512) || + (uc == 66927) || (uc == 67671) || (uc >= 67703 && uc <= 67704) || + (uc == 67871) || (uc == 67903) || (uc >= 68176 && uc <= 68184) || + (uc == 68223) || (uc == 68296) || (uc >= 68336 && uc <= 68342) || + (uc >= 68409 && uc <= 68415) || (uc >= 68505 && uc <= 68508) || + (uc == 69293) || (uc >= 69461 && uc <= 69465) || + (uc >= 69510 && uc <= 69513) || (uc >= 69703 && uc <= 69709) || + (uc >= 69819 && uc <= 69820) || (uc >= 69822 && uc <= 69825) || + (uc >= 69952 && uc <= 69955) || (uc >= 70004 && uc <= 70005) || + (uc >= 70085 && uc <= 70088) || (uc == 70093) || (uc == 70107) || + (uc >= 70109 && uc <= 70111) || (uc >= 70200 && uc <= 70205) || + (uc == 70313) || (uc >= 70731 && uc <= 70735) || + (uc >= 70746 && uc <= 70747) || (uc == 70749) || (uc == 70854) || + (uc >= 71105 && uc <= 71127) || (uc >= 71233 && uc <= 71235) || + (uc >= 71264 && uc <= 71276) || (uc == 71353) || + (uc >= 71484 && uc <= 71487) || (uc == 71739) || + (uc >= 72004 && uc <= 72006) || (uc == 72162) || + (uc >= 72255 && uc <= 72262) || (uc >= 72346 && uc <= 72348) || + (uc >= 72350 && uc <= 72354) || (uc >= 72448 && uc <= 72457) || + (uc >= 72769 && uc <= 72773) || (uc >= 72816 && uc <= 72817) || + (uc >= 73463 && uc <= 73464) || (uc >= 73539 && uc <= 73551) || + (uc >= 73685 && uc <= 73713) || (uc == 73727) || + (uc >= 74864 && uc <= 74868) || (uc >= 77809 && uc <= 77810) || + (uc >= 92782 && uc <= 92783) || (uc == 92917) || + (uc >= 92983 && uc <= 92991) || (uc >= 92996 && uc <= 92997) || + (uc >= 93847 && uc <= 93850) || (uc == 94178) || (uc == 113820) || + (uc == 113823) || (uc >= 118608 && uc <= 118723) || + (uc >= 118784 && uc <= 119029) || (uc >= 119040 && uc <= 119078) || + (uc >= 119081 && uc <= 119140) || (uc >= 119146 && uc <= 119148) || + (uc >= 119171 && uc <= 119172) || (uc >= 119180 && uc <= 119209) || + (uc >= 119214 && uc <= 119274) || (uc >= 119296 && uc <= 119361) || + (uc == 119365) || (uc >= 119552 && uc <= 119638) || (uc == 120513) || + (uc == 120539) || (uc == 120571) || (uc == 120597) || (uc == 120629) || + (uc == 120655) || (uc == 120687) || (uc == 120713) || (uc == 120745) || + (uc == 120771) || (uc >= 120832 && uc <= 121343) || + (uc >= 121399 && uc <= 121402) || (uc >= 121453 && uc <= 121460) || + (uc >= 121462 && uc <= 121475) || (uc >= 121477 && uc <= 121483) || + (uc == 123215) || (uc == 123647) || (uc >= 125278 && uc <= 125279) || + (uc == 126124) || (uc == 126128) || (uc == 126254) || + (uc >= 126704 && uc <= 126705) || (uc >= 126976 && uc <= 127019) || + (uc >= 127024 && uc <= 127123) || (uc >= 127136 && uc <= 127150) || + (uc >= 127153 && uc <= 127167) || (uc >= 127169 && uc <= 127183) || + (uc >= 127185 && uc <= 127221) || (uc >= 127245 && uc <= 127405) || + (uc >= 127462 && uc <= 127490) || (uc >= 127504 && uc <= 127547) || + (uc >= 127552 && uc <= 127560) || (uc >= 127568 && uc <= 127569) || + (uc >= 127584 && uc <= 127589) || (uc >= 127744 && uc <= 128727) || + (uc >= 128732 && uc <= 128748) || (uc >= 128752 && uc <= 128764) || + (uc >= 128768 && uc <= 128886) || (uc >= 128891 && uc <= 128985) || + (uc >= 128992 && uc <= 129003) || (uc == 129008) || + (uc >= 129024 && uc <= 129035) || (uc >= 129040 && uc <= 129095) || + (uc >= 129104 && uc <= 129113) || (uc >= 129120 && uc <= 129159) || + (uc >= 129168 && uc <= 129197) || (uc >= 129200 && uc <= 129201) || + (uc >= 129280 && uc <= 129619) || (uc >= 129632 && uc <= 129645) || + (uc >= 129648 && uc <= 129660) || (uc >= 129664 && uc <= 129672) || + (uc >= 129680 && uc <= 129725) || (uc >= 129727 && uc <= 129733) || + (uc >= 129742 && uc <= 129755) || (uc >= 129760 && uc <= 129768) || + (uc >= 129776 && uc <= 129784) || (uc >= 129792 && uc <= 129938) || + (uc >= 129940 && uc <= 129994))); + } } diff --git a/pkg/cmark/utf8.h b/pkg/cmark/utf8.h index fb67075..33b7637 100644 --- a/pkg/cmark/utf8.h +++ b/pkg/cmark/utf8.h @@ -1,5 +1,5 @@ -// Code generated by ../../scripts/copy-lib ../../cmark-src at 5ba25ff40eba44c811f79ab6a792baf945b8307c DO NOT EDIT. -// See ../../cmark-src/COPYING for license +// Code generated by ../../scripts/copy-lib ../../cmark-src/ at +8fbf029685482827828b5858444157052f1b0a5f DO NOT EDIT. +// See ../../cmark-src//COPYING for license #ifndef CMARK_UTF8_H #define CMARK_UTF8_H @@ -18,6 +18,7 @@ void cmark_utf8proc_check(cmark_strbuf *dest, const uint8_t *line, bufsize_t size); int cmark_utf8proc_is_space(int32_t uc); int cmark_utf8proc_is_punctuation(int32_t uc); +int cmark_utf8proc_is_punctuation_or_symbol(int32_t uc); #ifdef __cplusplus } diff --git a/pkg/cmark/xml.c b/pkg/cmark/xml.c index 94de68b..728d123 100644 --- a/pkg/cmark/xml.c +++ b/pkg/cmark/xml.c @@ -1,11 +1,11 @@ -// Code generated by ../../scripts/copy-lib ../../cmark-src at 5ba25ff40eba44c811f79ab6a792baf945b8307c DO NOT EDIT. -// See ../../cmark-src/COPYING for license -#include +// Code generated by ../../scripts/copy-lib ../../cmark-src/ at +8fbf029685482827828b5858444157052f1b0a5f DO NOT EDIT. +// See ../../cmark-src//COPYING for license +#include +#include #include +#include #include -#include -#include "config.h" #include "cmark.h" #include "node.h" #include "buffer.h" @@ -76,7 +76,7 @@ static void escape_xml(cmark_strbuf *ob, const unsigned char *src, static void escape_xml_str(cmark_strbuf *dest, const unsigned char *source) { if (source) - escape_xml(dest, source, strlen((char *)source)); + escape_xml(dest, source, (bufsize_t)strlen((char *)source)); } struct render_state { @@ -84,7 +84,7 @@ struct render_state { int indent; }; -static CMARK_INLINE void indent(struct render_state *state) { +static inline void indent(struct render_state *state) { int i; for (i = 0; i < state->indent && i < MAX_INDENT; i++) { cmark_strbuf_putc(state->xml, ' ');