summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/chunk.h43
-rw-r--r--src/cmark.h2
-rw-r--r--src/inlines.h6
-rw-r--r--src/references.h4
4 files changed, 34 insertions, 21 deletions
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
diff --git a/src/cmark.h b/src/cmark.h
index 1ffbcf1..63b60dc 100644
--- a/src/cmark.h
+++ b/src/cmark.h
@@ -29,7 +29,7 @@ struct node_inl {
INL_IMAGE
} tag;
union {
- chunk literal;
+ cmark_chunk literal;
struct node_inl *inlines;
struct {
struct node_inl *label;
diff --git a/src/inlines.h b/src/inlines.h
index 623a075..042172f 100644
--- a/src/inlines.h
+++ b/src/inlines.h
@@ -1,9 +1,9 @@
#ifndef _INLINES_H_
#define _INLINES_H_
-unsigned char *clean_url(chunk *url);
-unsigned char *clean_autolink(chunk *url, int is_email);
-unsigned char *clean_title(chunk *title);
+unsigned char *clean_url(cmark_chunk *url);
+unsigned char *clean_autolink(cmark_chunk *url, int is_email);
+unsigned char *clean_title(cmark_chunk *title);
node_inl* parse_inlines(cmark_strbuf *input, reference_map *refmap);
void free_inlines(node_inl* e);
diff --git a/src/references.h b/src/references.h
index 28937f1..82596ca 100644
--- a/src/references.h
+++ b/src/references.h
@@ -21,7 +21,7 @@ typedef struct reference_map reference_map;
reference_map *reference_map_new(void);
void reference_map_free(reference_map *map);
-reference* reference_lookup(reference_map *map, chunk *label);
-extern void reference_create(reference_map *map, chunk *label, chunk *url, chunk *title);
+reference* reference_lookup(reference_map *map, cmark_chunk *label);
+extern void reference_create(reference_map *map, cmark_chunk *label, cmark_chunk *url, cmark_chunk *title);
#endif