diff options
author | John MacFarlane <jgm@berkeley.edu> | 2016-01-18 09:33:43 -0800 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2016-01-18 09:33:43 -0800 |
commit | e1d1593f514a4975e015ed3fdd69f9c1c5c3142d (patch) | |
tree | a675ed66d3dcf5224db51521eb8f63452d647da7 /src | |
parent | c7904b06f57f8ad28f2f288267744231334e5973 (diff) |
Automatic code reformat.
Diffstat (limited to 'src')
-rw-r--r-- | src/chunk.h | 8 | ||||
-rw-r--r-- | src/commonmark.c | 15 | ||||
-rw-r--r--[-rwxr-xr-x] | src/render.c | 22 |
3 files changed, 23 insertions, 22 deletions
diff --git a/src/chunk.h b/src/chunk.h index 7007492..b25831b 100644 --- a/src/chunk.h +++ b/src/chunk.h @@ -48,8 +48,8 @@ static CMARK_INLINE void cmark_chunk_trim(cmark_chunk *c) { cmark_chunk_rtrim(c); } -static CMARK_INLINE bufsize_t - cmark_chunk_strchr(cmark_chunk *ch, int c, bufsize_t offset) { +static CMARK_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; @@ -96,8 +96,8 @@ static CMARK_INLINE cmark_chunk cmark_chunk_literal(const char *data) { return c; } -static CMARK_INLINE cmark_chunk - cmark_chunk_dup(const cmark_chunk *ch, bufsize_t pos, bufsize_t len) { +static CMARK_INLINE cmark_chunk cmark_chunk_dup(const cmark_chunk *ch, + bufsize_t pos, bufsize_t len) { cmark_chunk c = {ch->data + pos, len, 0}; return c; } diff --git a/src/commonmark.c b/src/commonmark.c index cb30601..60b745c 100644 --- a/src/commonmark.c +++ b/src/commonmark.c @@ -23,8 +23,9 @@ 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 && - cmark_isdigit(renderer->buffer->ptr[renderer->buffer->size - 1]); + 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]; @@ -35,11 +36,11 @@ static inline void outc(cmark_renderer *renderer, cmark_escaping escape, c == '>' || c == '\\' || c == '`' || c == '!' || (c == '&' && isalpha(nextc)) || (c == '!' && nextc == '[') || (renderer->begin_content && (c == '-' || c == '+' || c == '=') && - // begin_content doesn't get set to false til we've passed digits - // at the beginning of line, so... - !follows_digit) || + // begin_content doesn't get set to false til we've passed digits + // at the beginning of line, so... + !follows_digit) || (renderer->begin_content && (c == '.' || c == ')') && follows_digit && - (nextc == 0 || cmark_isspace(nextc))))) || + (nextc == 0 || cmark_isspace(nextc))))) || (escape == URL && (c == '`' || c == '<' || c == '>' || isspace(c) || c == '\\' || c == ')' || c == '(')) || (escape == TITLE && @@ -178,7 +179,7 @@ static int S_render_node(cmark_renderer *renderer, cmark_node *node, if (!(node->type == CMARK_NODE_ITEM && node->prev == NULL && entering)) { tmp = get_containing_block(node); renderer->in_tight_list_item = - tmp && // tmp might be NULL if there is no containing block + tmp && // tmp might be NULL if there is no containing block ((tmp->type == CMARK_NODE_ITEM && cmark_node_get_list_tight(tmp->parent)) || (tmp && tmp->parent && tmp->parent->type == CMARK_NODE_ITEM && diff --git a/src/render.c b/src/render.c index 2c941bf..fea9b3a 100755..100644 --- a/src/render.c +++ b/src/render.c @@ -64,7 +64,7 @@ static void S_out(cmark_renderer *renderer, const char *source, bool wrap, nextc = source[i + len]; if (c == 32 && wrap) { if (!renderer->begin_line) { - last_nonspace = renderer->buffer->size; + last_nonspace = renderer->buffer->size; cmark_strbuf_putc(renderer->buffer, ' '); renderer->column += 1; renderer->begin_line = false; @@ -73,11 +73,11 @@ static void S_out(cmark_renderer *renderer, const char *source, bool wrap, while (source[i + 1] == ' ') { i++; } - // We don't allow breaks that make a digit the first character - // because this causes problems with commonmark output. - if (!cmark_isdigit(source[i + 1])) { + // We don't allow breaks that make a digit the first character + // because this causes problems with commonmark output. + if (!cmark_isdigit(source[i + 1])) { renderer->last_breakable = last_nonspace; - } + } } } else if (c == 10) { @@ -93,13 +93,13 @@ static void S_out(cmark_renderer *renderer, const char *source, bool wrap, // finished parsing a digit. Reason: in commonmark // we need to escape a potential list marker after // a digit: - renderer->begin_content = renderer->begin_content && - cmark_isdigit(c) == 1; + renderer->begin_content = + renderer->begin_content && cmark_isdigit(c) == 1; } else { (renderer->outc)(renderer, escape, c, nextc); renderer->begin_line = false; - renderer->begin_content = renderer->begin_content && - cmark_isdigit(c) == 1; + renderer->begin_content = + renderer->begin_content && cmark_isdigit(c) == 1; } // If adding the character went beyond width, look for an @@ -153,8 +153,8 @@ char *cmark_render(cmark_node *root, int options, int width, char *result; cmark_iter *iter = cmark_iter_new(root); - cmark_renderer renderer = {&buf, &pref, 0, width, 0, 0, true, - true, false, false, + cmark_renderer renderer = {&buf, &pref, 0, width, 0, + 0, true, true, false, false, outc, S_cr, S_blankline, S_out}; while ((ev_type = cmark_iter_next(iter)) != CMARK_EVENT_DONE) { |