From 9c5d074b0067b564f230b3770b2026afb9bb6998 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Mon, 29 Dec 2014 22:31:17 -0800 Subject: Added cmark_ prefix to functions in cmark_ctype. --- src/blocks.c | 8 ++++---- src/buffer.c | 6 +++--- src/chunk.h | 4 ++-- src/cmark_ctype.c | 8 ++++---- src/cmark_ctype.h | 8 ++++---- src/inlines.c | 12 ++++++------ src/utf8.c | 2 +- 7 files changed, 24 insertions(+), 24 deletions(-) (limited to 'src') diff --git a/src/blocks.c b/src/blocks.c index b3ea362..6a89312 100644 --- a/src/blocks.c +++ b/src/blocks.c @@ -348,7 +348,7 @@ static int parse_list_marker(cmark_chunk *input, int pos, cmark_list **dataptr) if ((c == '*' || c == '-' || c == '+') && !scan_hrule(input, pos)) { pos++; - if (!isspace(peek_at(input, pos))) { + if (!cmark_isspace(peek_at(input, pos))) { return 0; } data = (cmark_list *)calloc(1, sizeof(*data)); @@ -362,18 +362,18 @@ static int parse_list_marker(cmark_chunk *input, int pos, cmark_list **dataptr) data->delimiter = CMARK_PERIOD_DELIM; data->tight = false; } - } else if (isdigit(c)) { + } else if (cmark_isdigit(c)) { int start = 0; do { start = (10 * start) + (peek_at(input, pos) - '0'); pos++; - } while (isdigit(peek_at(input, pos))); + } while (cmark_isdigit(peek_at(input, pos))); c = peek_at(input, pos); if (c == '.' || c == ')') { pos++; - if (!isspace(peek_at(input, pos))) { + if (!cmark_isspace(peek_at(input, pos))) { return 0; } data = (cmark_list *)calloc(1, sizeof(*data)); diff --git a/src/buffer.c b/src/buffer.c index 40e8674..f273f45 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -308,7 +308,7 @@ void cmark_strbuf_rtrim(cmark_strbuf *buf) return; while (buf->size > 0) { - if (!isspace(buf->ptr[buf->size - 1])) + if (!cmark_isspace(buf->ptr[buf->size - 1])) break; buf->size--; @@ -324,7 +324,7 @@ void cmark_strbuf_trim(cmark_strbuf *buf) if (!buf->size) return; - while (i < buf->size && isspace(buf->ptr[i])) + while (i < buf->size && cmark_isspace(buf->ptr[i])) i++; cmark_strbuf_drop(buf, i); @@ -365,7 +365,7 @@ extern void cmark_strbuf_unescape(cmark_strbuf *buf) int r, w; for (r = 0, w = 0; r < buf->size; ++r) { - if (buf->ptr[r] == '\\' && ispunct(buf->ptr[r + 1])) + if (buf->ptr[r] == '\\' && cmark_ispunct(buf->ptr[r + 1])) continue; buf->ptr[w++] = buf->ptr[r]; diff --git a/src/chunk.h b/src/chunk.h index ba6c89e..54c4b16 100644 --- a/src/chunk.h +++ b/src/chunk.h @@ -27,7 +27,7 @@ static inline void cmark_chunk_ltrim(cmark_chunk *c) { assert(!c->alloc); - while (c->len && isspace(c->data[0])) { + while (c->len && cmark_isspace(c->data[0])) { c->data++; c->len--; } @@ -36,7 +36,7 @@ static inline void cmark_chunk_ltrim(cmark_chunk *c) static inline void cmark_chunk_rtrim(cmark_chunk *c) { while (c->len > 0) { - if (!isspace(c->data[c->len - 1])) + if (!cmark_isspace(c->data[c->len - 1])) break; c->len--; diff --git a/src/cmark_ctype.c b/src/cmark_ctype.c index 9ed4b5c..7ced3a2 100644 --- a/src/cmark_ctype.c +++ b/src/cmark_ctype.c @@ -1,7 +1,7 @@ /** * Returns 1 if c is a "whitespace" character as defined by the spec. */ -int isspace(char c) +int cmark_isspace(char c) { return (c == 0x09 || c == 0x20 || @@ -12,7 +12,7 @@ int isspace(char c) /** * Returns 1 if c is an ascii punctuation character. */ -int ispunct(char c) +int cmark_ispunct(char c) { return ((c >= 33 && c <= 47) || (c >= 58 && c <= 64) || @@ -20,14 +20,14 @@ int ispunct(char c) (c >= 123 && c <= 126)); } -int isalnum(char c) +int cmark_isalnum(char c) { return ((c >= 48 && c <= 57) || (c >= 65 && c <= 90) || (c >= 97 && c <= 122)); } -int isdigit(char c) +int cmark_isdigit(char c) { return (c >= 48 && c <= 57); } diff --git a/src/cmark_ctype.h b/src/cmark_ctype.h index afc605e..7423f80 100644 --- a/src/cmark_ctype.h +++ b/src/cmark_ctype.h @@ -2,10 +2,10 @@ * We want cmark to behave the same no matter what the system locale. */ -int isspace(char c); +int cmark_isspace(char c); -int ispunct(char c); +int cmark_ispunct(char c); -int isalnum(char c); +int cmark_isalnum(char c); -int isdigit(char c); +int cmark_isdigit(char c); diff --git a/src/inlines.c b/src/inlines.c index 9d2d7f8..d5a19cb 100644 --- a/src/inlines.c +++ b/src/inlines.c @@ -286,10 +286,10 @@ scan_delims(subject* subj, unsigned char c, bool * can_open, bool * can_close) !utf8proc_is_space(after_char) && !utf8proc_is_punctuation(after_char)); if (c == '_') { - *can_open = *can_open && - !(before_char < 128 && isalnum((char)before_char)); - *can_close = *can_close && - !(before_char < 128 && isalnum((char)after_char)); + *can_open = *can_open && !(before_char < 128 && + cmark_isalnum((char)before_char)); + *can_close = *can_close && !(before_char < 128 && + cmark_isalnum((char)after_char)); } return numdelims; } @@ -489,7 +489,7 @@ static cmark_node* handle_backslash(subject *subj) { advance(subj); unsigned char nextchar = peek_char(subj); - if (ispunct(nextchar)) { // only ascii symbols and newline can be escaped + if (cmark_ispunct(nextchar)) { // only ascii symbols and newline can be escaped advance(subj); return make_str(cmark_chunk_dup(&subj->input, subj->pos - 1, 1)); } else if (nextchar == '\n') { @@ -645,7 +645,7 @@ static int link_label(subject* subj, cmark_chunk *raw_label) if (c == '\\') { advance(subj); length++; - if (ispunct(peek_char(subj))) { + if (cmark_ispunct(peek_char(subj))) { advance(subj); length++; } diff --git a/src/utf8.c b/src/utf8.c index 50d8834..ffb050d 100644 --- a/src/utf8.c +++ b/src/utf8.c @@ -269,7 +269,7 @@ int utf8proc_is_space(int32_t uc) // matches anything in the P[cdefios] classes. int utf8proc_is_punctuation(int32_t uc) { - return ((uc < 128 && ispunct((char)uc)) || + return ((uc < 128 && cmark_ispunct((char)uc)) || uc == 161 || uc == 167 || uc == 171 || -- cgit v1.2.3