summaryrefslogtreecommitdiff
path: root/src/chunk.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/chunk.h')
-rw-r--r--src/chunk.h34
1 files changed, 17 insertions, 17 deletions
diff --git a/src/chunk.h b/src/chunk.h
index b29c1b9..0f48791 100644
--- a/src/chunk.h
+++ b/src/chunk.h
@@ -11,9 +11,9 @@ typedef struct {
unsigned char *data;
int len;
int alloc; // also implies a NULL-terminated string
-} chunk;
+} cmark_chunk;
-static inline void chunk_free(chunk *c)
+static inline void cmark_chunk_free(cmark_chunk *c)
{
if (c->alloc)
free(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 = (unsigned char *)memchr(ch->data + offset, c, ch->len - offset);
return p ? (int)(p - ch->data) : ch->len;
}
-static inline const char *chunk_to_cstr(chunk *c)
+static inline const char *cmark_chunk_to_cstr(cmark_chunk *c)
{
unsigned char *str;
@@ -73,7 +73,7 @@ static inline const char *chunk_to_cstr(chunk *c)
return (char *)str;
}
-static inline void chunk_set_cstr(chunk *c, const char *str)
+static inline void cmark_chunk_set_cstr(cmark_chunk *c, const char *str)
{
if (c->alloc) {
free(c->data);
@@ -84,24 +84,24 @@ static inline void chunk_set_cstr(chunk *c, const char *str)
memcpy(c->data, str, c->len + 1);
}
-static inline chunk chunk_literal(const char *data)
+static inline cmark_chunk cmark_chunk_literal(const char *data)
{
- chunk c = {(unsigned char *)data, data ? strlen(data) : 0, 0};
+ cmark_chunk c = {(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(strbuf *buf)
+static inline cmark_chunk cmark_chunk_buf_detach(cmark_strbuf *buf)
{
- chunk c;
+ cmark_chunk c;
c.len = buf->size;
- c.data = strbuf_detach(buf);
+ c.data = cmark_strbuf_detach(buf);
c.alloc = 1;
return c;