summaryrefslogtreecommitdiff
path: root/src/inlines.c
diff options
context:
space:
mode:
authorVicent Marti <tanoku@gmail.com>2014-09-04 18:42:49 +0200
committerVicent Marti <tanoku@gmail.com>2014-09-09 03:39:16 +0200
commit647b15968c95ec268d6d728eea73756c7ba648a8 (patch)
tree3b30eb0821ee23197f643cbc87170e998a690ade /src/inlines.c
parent543c2c94d71adee42c7bd2f8027d75c87ed8120d (diff)
Rename inl
Diffstat (limited to 'src/inlines.c')
-rw-r--r--src/inlines.c88
1 files changed, 44 insertions, 44 deletions
diff --git a/src/inlines.c b/src/inlines.c
index 33973df..301125e 100644
--- a/src/inlines.c
+++ b/src/inlines.c
@@ -28,9 +28,9 @@ inline static chunk chunk_literal(const char *data);
inline static chunk chunk_buf_detach(strbuf *buf);
inline static chunk chunk_dup(const chunk *ch, int pos, int len);
-static inl *parse_chunk_inlines(chunk *chunk, reference** refmap);
-static inl *parse_inlines_while(subject* subj, int (*f)(subject*));
-static int parse_inline(subject* subj, inl ** last);
+static struct inl *parse_chunk_inlines(chunk *chunk, reference** refmap);
+static struct inl *parse_inlines_while(subject* subj, int (*f)(subject*));
+static int parse_inline(subject* subj, struct inl ** last);
static void subject_from_chunk(subject *e, chunk *chunk, reference** refmap);
static void subject_from_buf(subject *e, strbuf *buffer, reference** refmap);
@@ -108,9 +108,9 @@ extern void add_reference(reference** refmap, reference* ref)
}
}
-inline static inl* make_link_from_reference(inl* label, reference *ref)
+inline static struct inl* make_link_from_reference(struct inl* label, reference *ref)
{
- inl* e = (inl*) malloc(sizeof(inl));
+ struct inl* e = (struct inl*) malloc(sizeof(struct inl));
e->tag = INL_LINK;
e->content.linkable.label = label;
e->content.linkable.url = strdup(ref->url);
@@ -120,9 +120,9 @@ inline static inl* make_link_from_reference(inl* label, reference *ref)
}
// Create an inline with a linkable string value.
-inline static inl* make_link(inl* label, chunk url, chunk title, int is_email)
+inline static struct inl* make_link(struct inl* label, chunk url, chunk title, int is_email)
{
- inl* e = (inl*) malloc(sizeof(inl));
+ struct inl* e = (struct inl*) malloc(sizeof(struct inl));
e->tag = INL_LINK;
e->content.linkable.label = label;
e->content.linkable.url = clean_url(&url, is_email);
@@ -131,9 +131,9 @@ inline static inl* make_link(inl* label, chunk url, chunk title, int is_email)
return e;
}
-inline static inl* make_inlines(int t, inl* contents)
+inline static struct inl* make_inlines(int t, struct inl* contents)
{
- inl* e = (inl*) malloc(sizeof(inl));
+ struct inl* e = (struct inl*) malloc(sizeof(struct inl));
e->tag = t;
e->content.inlines = contents;
e->next = NULL;
@@ -141,9 +141,9 @@ inline static inl* make_inlines(int t, inl* contents)
}
// Create an inline with a literal string value.
-inline static inl* make_literal(int t, chunk s)
+inline static struct inl* make_literal(int t, chunk s)
{
- inl* e = (inl*) malloc(sizeof(inl));
+ struct inl* e = (struct inl*) malloc(sizeof(struct inl));
e->tag = t;
e->content.literal = s;
e->next = NULL;
@@ -151,9 +151,9 @@ inline static inl* make_literal(int t, chunk s)
}
// Create an inline with no value.
-inline static inl* make_simple(int t)
+inline static struct inl* make_simple(int t)
{
- inl* e = (inl*) malloc(sizeof(inl));
+ struct inl* e = (struct inl*) malloc(sizeof(struct inl));
e->tag = t;
e->next = NULL;
return e;
@@ -170,9 +170,9 @@ inline static inl* make_simple(int t)
#define make_strong(contents) make_inlines(INL_STRONG, contents)
// Free an inline list.
-extern void free_inlines(inl* e)
+extern void free_inlines(struct inl* e)
{
- inl * next;
+ struct inl * next;
while (e != NULL) {
switch (e->tag){
case INL_STRING:
@@ -205,12 +205,12 @@ extern void free_inlines(inl* e)
// Append inline list b to the end of inline list a.
// Return pointer to head of new list.
-inline static inl* append_inlines(inl* a, inl* b)
+inline static struct inl* append_inlines(struct inl* a, struct inl* b)
{
if (a == NULL) { // NULL acts like an empty list
return b;
}
- inl* cur = a;
+ struct inl* cur = a;
while (cur->next) {
cur = cur->next;
}
@@ -336,7 +336,7 @@ static void normalize_whitespace(strbuf *s)
// Parse backtick code section or raw backticks, return an inline.
// Assumes that the subject has a backtick at the current position.
-static inl* handle_backticks(subject *subj)
+static struct inl* handle_backticks(subject *subj)
{
chunk openticks = take_while(subj, isbacktick);
int startpos = subj->pos;
@@ -382,15 +382,15 @@ static int scan_delims(subject* subj, char c, bool * can_open, bool * can_close)
// Parse strong/emph or a fallback.
// Assumes the subject has '_' or '*' at the current position.
-static inl* handle_strong_emph(subject* subj, char c)
+static struct inl* handle_strong_emph(subject* subj, char c)
{
bool can_open, can_close;
- inl * result = NULL;
- inl ** last = malloc(sizeof(inl *));
- inl * new;
- inl * il;
- inl * first_head = NULL;
- inl * first_close = NULL;
+ struct inl * result = NULL;
+ struct inl ** last = malloc(sizeof(struct inl *));
+ struct inl * new;
+ struct inl * il;
+ struct inl * first_head = NULL;
+ struct inl * first_close = NULL;
int first_close_delims = 0;
int numdelims;
@@ -508,7 +508,7 @@ done:
}
// Parse backslash-escape or just a backslash, returning an inline.
-static inl* handle_backslash(subject *subj)
+static struct inl* handle_backslash(subject *subj)
{
advance(subj);
unsigned char nextchar = peek_char(subj);
@@ -525,10 +525,10 @@ static inl* handle_backslash(subject *subj)
// Parse an entity or a regular "&" string.
// Assumes the subject has an '&' character at the current position.
-static inl* handle_entity(subject* subj)
+static struct inl* handle_entity(subject* subj)
{
int match;
- inl *result;
+ struct inl *result;
match = scan_entity(&subj->input, subj->pos);
if (match) {
result = make_entity(chunk_dup(&subj->input, subj->pos, match));
@@ -542,10 +542,10 @@ static inl* handle_entity(subject* subj)
// Like make_str, but parses entities.
// Returns an inline sequence consisting of str and entity elements.
-static inl *make_str_with_entities(chunk *content)
+static struct inl *make_str_with_entities(chunk *content)
{
- inl *result = NULL;
- inl *new;
+ struct inl *result = NULL;
+ struct inl *new;
int searchpos;
char c;
subject subj;
@@ -634,7 +634,7 @@ static unsigned char *clean_title(chunk *title)
// Parse an autolink or HTML tag.
// Assumes the subject has a '<' character at the current position.
-static inl* handle_pointy_brace(subject* subj)
+static struct inl* handle_pointy_brace(subject* subj)
{
int matchlen = 0;
chunk contents;
@@ -693,7 +693,7 @@ static inl* handle_pointy_brace(subject* subj)
static int link_label(subject* subj, chunk *raw_label)
{
int nestlevel = 0;
- inl* tmp = NULL;
+ struct inl* tmp = NULL;
int startpos = subj->pos;
if (subj->label_nestlevel) {
@@ -751,10 +751,10 @@ static int link_label(subject* subj, chunk *raw_label)
}
// Parse a link or the link portion of an image, or return a fallback.
-static inl* handle_left_bracket(subject* subj)
+static struct inl* handle_left_bracket(subject* subj)
{
- inl *lab = NULL;
- inl *result = NULL;
+ struct inl *lab = NULL;
+ struct inl *result = NULL;
reference *ref;
int n;
int sps;
@@ -838,7 +838,7 @@ static inl* handle_left_bracket(subject* subj)
// Parse a hard or soft linebreak, returning an inline.
// Assumes the subject has a newline at the current position.
-static inl* handle_newline(subject *subj)
+static struct inl* handle_newline(subject *subj)
{
int nlpos = subj->pos;
// skip over newline
@@ -862,16 +862,16 @@ inline static int not_eof(subject* subj)
}
// Parse inlines while a predicate is satisfied. Return inlines.
-extern inl* parse_inlines_while(subject* subj, int (*f)(subject*))
+extern struct inl* parse_inlines_while(subject* subj, int (*f)(subject*))
{
- inl* result = NULL;
- inl** last = &result;
+ struct inl* result = NULL;
+ struct inl** last = &result;
while ((*f)(subj) && parse_inline(subj, last)) {
}
return result;
}
-inl *parse_chunk_inlines(chunk *chunk, reference** refmap)
+struct inl *parse_chunk_inlines(chunk *chunk, reference** refmap)
{
subject subj;
subject_from_chunk(&subj, chunk, refmap);
@@ -894,9 +894,9 @@ static int subject_find_special_char(subject *subj)
// Parse an inline, advancing subject, and add it to last element.
// Adjust tail to point to new last element of list.
// Return 0 if no inline can be parsed, 1 otherwise.
-static int parse_inline(subject* subj, inl ** last)
+static int parse_inline(subject* subj, struct inl ** last)
{
- inl* new = NULL;
+ struct inl* new = NULL;
chunk contents;
unsigned char c;
int endpos;
@@ -971,7 +971,7 @@ static int parse_inline(subject* subj, inl ** last)
return 1;
}
-extern inl* parse_inlines(strbuf *input, reference** refmap)
+extern struct inl* parse_inlines(strbuf *input, reference** refmap)
{
subject subj;
subject_from_buf(&subj, input, refmap);