From fc923ee0a3e3837fdb51c3f8fc6e99d16bdb8f4c Mon Sep 17 00:00:00 2001 From: Nick Wellnhofer Date: Wed, 12 Nov 2014 17:40:25 +0100 Subject: Prefix names in buffer.h --- src/chunk.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/chunk.h') diff --git a/src/chunk.h b/src/chunk.h index 015bbf9..208880a 100644 --- a/src/chunk.h +++ b/src/chunk.h @@ -79,12 +79,12 @@ static inline chunk chunk_dup(const chunk *ch, int pos, int len) return c; } -static inline chunk chunk_buf_detach(strbuf *buf) +static inline chunk chunk_buf_detach(cmark_strbuf *buf) { chunk c; c.len = buf->size; - c.data = strbuf_detach(buf); + c.data = cmark_strbuf_detach(buf); c.alloc = 1; return c; -- cgit v1.2.3 From e9ba8f064cb61239be6432ec60ab2ced3d9d339f Mon Sep 17 00:00:00 2001 From: Nick Wellnhofer Date: Wed, 12 Nov 2014 17:48:03 +0100 Subject: Prefix names in chunk.h --- src/chunk.h | 43 ++++++++++++++++++++++++++++--------------- 1 file changed, 28 insertions(+), 15 deletions(-) (limited to 'src/chunk.h') diff --git a/src/chunk.h b/src/chunk.h index 208880a..e4a57b2 100644 --- a/src/chunk.h +++ b/src/chunk.h @@ -11,9 +11,9 @@ typedef struct { const unsigned char *data; int len; int alloc; -} chunk; +} cmark_chunk; -static inline void chunk_free(chunk *c) +static inline void cmark_chunk_free(cmark_chunk *c) { if (c->alloc) free((char *)c->data); @@ -23,7 +23,7 @@ static inline void chunk_free(chunk *c) c->len = 0; } -static inline void chunk_ltrim(chunk *c) +static inline void cmark_chunk_ltrim(cmark_chunk *c) { assert(!c->alloc); @@ -33,7 +33,7 @@ static inline void chunk_ltrim(chunk *c) } } -static inline void chunk_rtrim(chunk *c) +static inline void cmark_chunk_rtrim(cmark_chunk *c) { while (c->len > 0) { if (!isspace(c->data[c->len - 1])) @@ -43,19 +43,19 @@ static inline void chunk_rtrim(chunk *c) } } -static inline void chunk_trim(chunk *c) +static inline void cmark_chunk_trim(cmark_chunk *c) { - chunk_ltrim(c); - chunk_rtrim(c); + cmark_chunk_ltrim(c); + cmark_chunk_rtrim(c); } -static inline int chunk_strchr(chunk *ch, int c, int offset) +static inline int cmark_chunk_strchr(cmark_chunk *ch, int c, int offset) { const unsigned char *p = memchr(ch->data + offset, c, ch->len - offset); return p ? (int)(p - ch->data) : ch->len; } -static inline unsigned char *chunk_to_cstr(chunk *c) +static inline unsigned char *cmark_chunk_to_cstr(cmark_chunk *c) { unsigned char *str; @@ -67,21 +67,21 @@ static inline unsigned char *chunk_to_cstr(chunk *c) return str; } -static inline chunk chunk_literal(const char *data) +static inline cmark_chunk cmark_chunk_literal(const char *data) { - chunk c = {(const unsigned char *)data, data ? strlen(data) : 0, 0}; + cmark_chunk c = {(const unsigned char *)data, data ? strlen(data) : 0, 0}; return c; } -static inline chunk chunk_dup(const chunk *ch, int pos, int len) +static inline cmark_chunk cmark_chunk_dup(const cmark_chunk *ch, int pos, int len) { - chunk c = {ch->data + pos, len, 0}; + cmark_chunk c = {ch->data + pos, len, 0}; return c; } -static inline chunk chunk_buf_detach(cmark_strbuf *buf) +static inline cmark_chunk cmark_chunk_buf_detach(cmark_strbuf *buf) { - chunk c; + cmark_chunk c; c.len = buf->size; c.data = cmark_strbuf_detach(buf); @@ -90,4 +90,17 @@ static inline chunk chunk_buf_detach(cmark_strbuf *buf) return c; } +#ifndef CMARK_NO_SHORT_NAMES + #define chunk cmark_chunk + #define chunk_free cmark_chunk_free + #define chunk_ltrim cmark_chunk_ltrim + #define chunk_rtrim cmark_chunk_rtrim + #define chunk_trim cmark_chunk_trim + #define chunk_strchr cmark_chunk_strchr + #define chunk_to_cstr cmark_chunk_to_cstr + #define chunk_literal cmark_chunk_literal + #define chunk_dup cmark_chunk_dup + #define chunk_buf_detach cmark_chunk_buf_detach +#endif + #endif -- cgit v1.2.3