summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNick Wellnhofer <wellnhofer@aevum.de>2014-11-28 16:00:08 +0100
committerNick Wellnhofer <wellnhofer@aevum.de>2014-11-28 16:14:01 +0100
commit44e6870b9629bc854e6f92e15518cde80af59f8d (patch)
treeb5994a54d61c5a4659e77aed79958deb7b26687b /src
parent170f2b6435a36f1e81132b4c11d30eb3e0b54975 (diff)
Use prefixed names for symbols from references.h
Diffstat (limited to 'src')
-rw-r--r--src/blocks.c4
-rw-r--r--src/cmark.c1
-rw-r--r--src/inlines.c16
-rw-r--r--src/parser.h1
-rw-r--r--src/references.c27
-rw-r--r--src/references.h9
6 files changed, 25 insertions, 33 deletions
diff --git a/src/blocks.c b/src/blocks.c
index d955e68..09a9306 100644
--- a/src/blocks.c
+++ b/src/blocks.c
@@ -49,7 +49,7 @@ cmark_doc_parser *cmark_new_doc_parser()
strbuf *line = (strbuf*)malloc(sizeof(strbuf));
cmark_strbuf_init(line, 256);
- parser->refmap = reference_map_new();
+ parser->refmap = cmark_reference_map_new();
parser->root = document;
parser->current = document;
parser->line_number = 0;
@@ -285,7 +285,7 @@ typedef struct BlockStack {
// Walk through cmark_node and all children, recursively, parsing
// string content into inline content where appropriate.
-static void process_inlines(cmark_node* cur, reference_map *refmap)
+static void process_inlines(cmark_node* cur, cmark_reference_map *refmap)
{
block_stack* stack = NULL;
block_stack* newstack = NULL;
diff --git a/src/cmark.c b/src/cmark.c
index 273a37b..945e392 100644
--- a/src/cmark.c
+++ b/src/cmark.c
@@ -2,7 +2,6 @@
#include <assert.h>
#include <stdio.h>
#include "node.h"
-#include "references.h"
#include "html/houdini.h"
#include "cmark.h"
#include "buffer.h"
diff --git a/src/inlines.c b/src/inlines.c
index c33cc84..49dc781 100644
--- a/src/inlines.c
+++ b/src/inlines.c
@@ -37,13 +37,14 @@ typedef struct DelimiterStack {
typedef struct Subject {
chunk input;
int pos;
- reference_map *refmap;
+ cmark_reference_map *refmap;
delimiter_stack *delimiters;
} subject;
static int parse_inline(subject* subj, cmark_node * parent);
-static void subject_from_buf(subject *e, strbuf *buffer, reference_map *refmap);
+static void subject_from_buf(subject *e, strbuf *buffer,
+ cmark_reference_map *refmap);
static int subject_find_special_char(subject *subj);
static unsigned char *cmark_clean_autolink(chunk *url, int is_email)
@@ -154,7 +155,8 @@ static unsigned char *bufdup(const unsigned char *buf)
return new_buf;
}
-static void subject_from_buf(subject *e, strbuf *buffer, reference_map *refmap)
+static void subject_from_buf(subject *e, strbuf *buffer,
+ cmark_reference_map *refmap)
{
e->input.data = buffer->ptr;
e->input.len = buffer->size;
@@ -649,7 +651,7 @@ static cmark_node* handle_close_bracket(subject* subj, cmark_node *parent)
int starturl, endurl, starttitle, endtitle, endall;
int n;
int sps;
- reference *ref;
+ cmark_reference *ref;
bool is_image = false;
chunk urlchunk, titlechunk;
unsigned char *url, *title;
@@ -731,7 +733,7 @@ static cmark_node* handle_close_bracket(subject* subj, cmark_node *parent)
subj->pos = initial_pos;
}
- ref = reference_lookup(subj->refmap, &raw_label);
+ ref = cmark_reference_lookup(subj->refmap, &raw_label);
chunk_free(&raw_label);
if (ref != NULL) { // found
@@ -933,7 +935,7 @@ static void spnl(subject* subj)
// Modify refmap if a reference is encountered.
// Return 0 if no reference found, otherwise position of subject
// after reference is parsed.
-int cmark_parse_reference_inline(strbuf *input, reference_map *refmap)
+int cmark_parse_reference_inline(strbuf *input, cmark_reference_map *refmap)
{
subject subj;
@@ -988,6 +990,6 @@ int cmark_parse_reference_inline(strbuf *input, reference_map *refmap)
return 0;
}
// insert reference into refmap
- reference_create(refmap, &lab, &url, &title);
+ cmark_reference_create(refmap, &lab, &url, &title);
return subj.pos;
}
diff --git a/src/parser.h b/src/parser.h
index 4bbea09..bbbc3b1 100644
--- a/src/parser.h
+++ b/src/parser.h
@@ -3,7 +3,6 @@
#include <stdio.h>
#include "node.h"
-#include "references.h"
#include "buffer.h"
#ifdef __cplusplus
diff --git a/src/references.c b/src/references.c
index 33cea12..2b1d0a7 100644
--- a/src/references.c
+++ b/src/references.c
@@ -16,7 +16,7 @@ refhash(const unsigned char *link_ref)
return hash;
}
-static void reference_free(reference *ref)
+static void reference_free(cmark_reference *ref)
{
if(ref != NULL) {
free(ref->label);
@@ -56,9 +56,9 @@ static unsigned char *normalize_reference(chunk *ref)
return result;
}
-static void add_reference(reference_map *map, reference* ref)
+static void add_reference(cmark_reference_map *map, cmark_reference* ref)
{
- reference *t = ref->next = map->table[ref->hash % REFMAP_SIZE];
+ cmark_reference *t = ref->next = map->table[ref->hash % REFMAP_SIZE];
while (t) {
if (t->hash == ref->hash &&
@@ -73,16 +73,17 @@ static void add_reference(reference_map *map, reference* ref)
map->table[ref->hash % REFMAP_SIZE] = ref;
}
-extern void reference_create(reference_map *map, chunk *label, chunk *url, chunk *title)
+void cmark_reference_create(cmark_reference_map *map, chunk *label, chunk *url,
+ chunk *title)
{
- reference *ref;
+ cmark_reference *ref;
unsigned char *reflabel = normalize_reference(label);
/* empty reference name, or composed from only whitespace */
if (reflabel == NULL)
return;
- ref = (reference *)calloc(1, sizeof(*ref));
+ ref = (cmark_reference *)calloc(1, sizeof(*ref));
if(ref != NULL) {
ref->label = reflabel;
ref->hash = refhash(ref->label);
@@ -96,9 +97,9 @@ extern void reference_create(reference_map *map, chunk *label, chunk *url, chunk
// Returns reference if refmap contains a reference with matching
// label, otherwise NULL.
-reference* reference_lookup(reference_map *map, chunk *label)
+cmark_reference* cmark_reference_lookup(cmark_reference_map *map, chunk *label)
{
- reference *ref = NULL;
+ cmark_reference *ref = NULL;
unsigned char *norm;
unsigned int hash;
@@ -126,7 +127,7 @@ reference* reference_lookup(reference_map *map, chunk *label)
return ref;
}
-void reference_map_free(reference_map *map)
+void cmark_reference_map_free(cmark_reference_map *map)
{
unsigned int i;
@@ -134,8 +135,8 @@ void reference_map_free(reference_map *map)
return;
for (i = 0; i < REFMAP_SIZE; ++i) {
- reference *ref = map->table[i];
- reference *next;
+ cmark_reference *ref = map->table[i];
+ cmark_reference *next;
while (ref) {
next = ref->next;
@@ -147,7 +148,7 @@ void reference_map_free(reference_map *map)
free(map);
}
-reference_map *reference_map_new(void)
+cmark_reference_map *cmark_reference_map_new(void)
{
- return (reference_map *)calloc(1, sizeof(reference_map));
+ return (cmark_reference_map *)calloc(1, sizeof(cmark_reference_map));
}
diff --git a/src/references.h b/src/references.h
index 572178d..69325bb 100644
--- a/src/references.h
+++ b/src/references.h
@@ -30,15 +30,6 @@ void cmark_reference_map_free(cmark_reference_map *map);
cmark_reference* cmark_reference_lookup(cmark_reference_map *map, cmark_chunk *label);
extern void cmark_reference_create(cmark_reference_map *map, cmark_chunk *label, cmark_chunk *url, cmark_chunk *title);
-#ifndef CMARK_NO_SHORT_NAMES
- #define reference cmark_reference
- #define reference_map cmark_reference_map
- #define reference_map_new cmark_reference_map_new
- #define reference_map_free cmark_reference_map_free
- #define reference_lookup cmark_reference_lookup
- #define reference_create cmark_reference_create
-#endif
-
#ifdef __cplusplus
}
#endif