diff --git a/hoedown.def b/hoedown.def index 09b54a7..3b2c69f 100644 --- a/hoedown.def +++ b/hoedown.def @@ -4,30 +4,36 @@ EXPORTS hoedown_autolink__www hoedown_autolink__email hoedown_autolink__url - hoedown_buffer_grow + hoedown_buffer_init hoedown_buffer_new - hoedown_buffer_cstr - hoedown_buffer_prefix + hoedown_buffer_reset + hoedown_buffer_grow hoedown_buffer_put hoedown_buffer_puts hoedown_buffer_putc - hoedown_buffer_free - hoedown_buffer_reset + hoedown_buffer_set + hoedown_buffer_sets + hoedown_buffer_eq + hoedown_buffer_eqs + hoedown_buffer_prefix hoedown_buffer_slurp + hoedown_buffer_cstr hoedown_buffer_printf + hoedown_buffer_free hoedown_document_new hoedown_document_render + hoedown_document_render_inline hoedown_document_free - hoedown_escape_html hoedown_escape_href + hoedown_escape_html + hoedown_html_smartypants hoedown_html_is_tag hoedown_html_renderer_new hoedown_html_toc_renderer_new hoedown_html_renderer_free - hoedown_html_smartypants - hoedown_stack_free + hoedown_stack_init + hoedown_stack_uninit hoedown_stack_grow - hoedown_stack_new hoedown_stack_push hoedown_stack_pop hoedown_stack_top diff --git a/src/document.c b/src/document.c index cf27290..c0e52ef 100644 --- a/src/document.c +++ b/src/document.c @@ -1736,7 +1736,7 @@ parse_blockcode(hoedown_buffer *ob, hoedown_document *doc, uint8_t *data, size_t /* parse_listitem • parsing of a single list item */ /* assuming initial prefix is already removed */ static size_t -parse_listitem(hoedown_buffer *ob, hoedown_document *doc, uint8_t *data, size_t size, hoedown_listflags *flags) +parse_listitem(hoedown_buffer *ob, hoedown_document *doc, uint8_t *data, size_t size, hoedown_list_flags *flags) { hoedown_buffer *work = 0, *inter = 0; size_t beg = 0, end, pre, sublist = 0, orgpre = 0, i; @@ -1873,7 +1873,7 @@ parse_listitem(hoedown_buffer *ob, hoedown_document *doc, uint8_t *data, size_t /* parse_list • parsing ordered or unordered list block */ static size_t -parse_list(hoedown_buffer *ob, hoedown_document *doc, uint8_t *data, size_t size, hoedown_listflags flags) +parse_list(hoedown_buffer *ob, hoedown_document *doc, uint8_t *data, size_t size, hoedown_list_flags flags) { hoedown_buffer *work = 0; size_t i = 0, j; @@ -2136,8 +2136,8 @@ parse_table_row( uint8_t *data, size_t size, size_t columns, - hoedown_tableflags *col_data, - hoedown_tableflags header_flag) + hoedown_table_flags *col_data, + hoedown_table_flags header_flag) { size_t i = 0, col; hoedown_buffer *row_work = 0; @@ -2193,7 +2193,7 @@ parse_table_header( uint8_t *data, size_t size, size_t *columns, - hoedown_tableflags **column_data) + hoedown_table_flags **column_data) { int pipes; size_t i = 0, col, header_end, under_end; @@ -2221,7 +2221,7 @@ parse_table_header( return 0; *columns = pipes + 1; - *column_data = hoedown_calloc(*columns, sizeof(hoedown_tableflags)); + *column_data = hoedown_calloc(*columns, sizeof(hoedown_table_flags)); /* Parse the header underline */ i++; @@ -2291,7 +2291,7 @@ parse_table( hoedown_buffer *body_work = 0; size_t columns; - hoedown_tableflags *col_data = NULL; + hoedown_table_flags *col_data = NULL; header_work = newbuf(doc, BUFFER_SPAN); body_work = newbuf(doc, BUFFER_BLOCK); @@ -2854,8 +2854,8 @@ hoedown_document_free(hoedown_document *doc) for (i = 0; i < (size_t)doc->work_bufs[BUFFER_BLOCK].asize; ++i) hoedown_buffer_free(doc->work_bufs[BUFFER_BLOCK].item[i]); - hoedown_stack_reset(&doc->work_bufs[BUFFER_SPAN]); - hoedown_stack_reset(&doc->work_bufs[BUFFER_BLOCK]); + hoedown_stack_uninit(&doc->work_bufs[BUFFER_SPAN]); + hoedown_stack_uninit(&doc->work_bufs[BUFFER_BLOCK]); free(doc); } diff --git a/src/document.h b/src/document.h index 539b206..9564f38 100644 --- a/src/document.h +++ b/src/document.h @@ -59,18 +59,18 @@ typedef enum hoedown_extensions { #define HOEDOWN_EXT_NEGATIVE (\ HOEDOWN_EXT_DISABLE_INDENTED_CODE ) -typedef enum hoedown_listflags { +typedef enum hoedown_list_flags { HOEDOWN_LIST_ORDERED = (1 << 0), HOEDOWN_LI_BLOCK = (1 << 1) /*
  • containing block data */ -} hoedown_listflags; +} hoedown_list_flags; -typedef enum hoedown_tableflags { +typedef enum hoedown_table_flags { HOEDOWN_TABLE_ALIGN_LEFT = 1, HOEDOWN_TABLE_ALIGN_RIGHT = 2, HOEDOWN_TABLE_ALIGN_CENTER = 3, HOEDOWN_TABLE_ALIGNMASK = 3, HOEDOWN_TABLE_HEADER = 4 -} hoedown_tableflags; +} hoedown_table_flags; typedef enum hoedown_autolink_type { HOEDOWN_AUTOLINK_NONE, /* used internally when it is not an autolink*/ @@ -94,12 +94,12 @@ struct hoedown_renderer { void (*blockhtml)(hoedown_buffer *ob,const hoedown_buffer *text, void *opaque); void (*header)(hoedown_buffer *ob, const hoedown_buffer *text, int level, void *opaque); void (*hrule)(hoedown_buffer *ob, void *opaque); - void (*list)(hoedown_buffer *ob, const hoedown_buffer *text, hoedown_listflags flags, void *opaque); - void (*listitem)(hoedown_buffer *ob, const hoedown_buffer *text, hoedown_listflags flags, void *opaque); + void (*list)(hoedown_buffer *ob, const hoedown_buffer *text, hoedown_list_flags flags, void *opaque); + void (*listitem)(hoedown_buffer *ob, const hoedown_buffer *text, hoedown_list_flags flags, void *opaque); void (*paragraph)(hoedown_buffer *ob, const hoedown_buffer *text, void *opaque); void (*table)(hoedown_buffer *ob, const hoedown_buffer *header, const hoedown_buffer *body, void *opaque); void (*table_row)(hoedown_buffer *ob, const hoedown_buffer *text, void *opaque); - void (*table_cell)(hoedown_buffer *ob, const hoedown_buffer *text, hoedown_tableflags flags, void *opaque); + void (*table_cell)(hoedown_buffer *ob, const hoedown_buffer *text, hoedown_table_flags flags, void *opaque); void (*footnotes)(hoedown_buffer *ob, const hoedown_buffer *text, void *opaque); void (*footnote_def)(hoedown_buffer *ob, const hoedown_buffer *text, unsigned int num, void *opaque); diff --git a/src/escape.c b/src/escape.c index 938d93c..b4ec911 100644 --- a/src/escape.c +++ b/src/escape.c @@ -64,16 +64,15 @@ hoedown_escape_href(hoedown_buffer *ob, const uint8_t *data, size_t size) while (i < size) { mark = i; - while (i < size && HREF_SAFE[data[i]] != 0) - i++; + while (i < size && HREF_SAFE[data[i]]) i++; - /* Optimization for cases when there's nothing to escape */ + /* Optimization for cases where there's nothing to escape */ if (mark == 0 && i >= size) { hoedown_buffer_put(ob, data, size); return; } - if (i > mark) { + if (likely(i > mark)) { hoedown_buffer_put(ob, data + mark, i - mark); } diff --git a/src/html.c b/src/html.c index 7bc8ff9..03c8500 100644 --- a/src/html.c +++ b/src/html.c @@ -265,7 +265,7 @@ rndr_link(hoedown_buffer *ob, const hoedown_buffer *link, const hoedown_buffer * } static void -rndr_list(hoedown_buffer *ob, const hoedown_buffer *text, unsigned int flags, void *opaque) +rndr_list(hoedown_buffer *ob, const hoedown_buffer *text, hoedown_list_flags flags, void *opaque) { if (ob->size) hoedown_buffer_putc(ob, '\n'); hoedown_buffer_put(ob, (uint8_t *)(flags & HOEDOWN_LIST_ORDERED ? "
      \n" : "