summaryrefslogtreecommitdiff
path: root/src/html.c
diff options
context:
space:
mode:
authorNick Wellnhofer <wellnhofer@aevum.de>2015-06-07 17:34:34 +0200
committerNick Wellnhofer <wellnhofer@aevum.de>2015-06-07 21:42:15 +0200
commit9087645812433abdc51eb7bb82ade8c3c3bccfa5 (patch)
tree7f10af1a8106b7f0b5270c706a7d3610a4e7a45d /src/html.c
parente477618d40cb3db39667f06085c67cdfa33710a2 (diff)
Avoid strlen in html.c
Diffstat (limited to 'src/html.c')
-rw-r--r--src/html.c19
1 files changed, 4 insertions, 15 deletions
diff --git a/src/html.c b/src/html.c
index 317eb45..a30bbca 100644
--- a/src/html.c
+++ b/src/html.c
@@ -13,20 +13,9 @@
static void escape_html(cmark_strbuf *dest, const unsigned char *source, bufsize_t length)
{
- if (length < 0)
- length = strlen((char *)source);
-
houdini_escape_html0(dest, source, length, 0);
}
-static void escape_href(cmark_strbuf *dest, const unsigned char *source, bufsize_t length)
-{
- if (length < 0)
- length = strlen((char *)source);
-
- houdini_escape_href(dest, source, length);
-}
-
static inline void cr(cmark_strbuf *html)
{
if (html->size && html->ptr[html->size - 1] != '\n')
@@ -261,8 +250,8 @@ S_render_node(cmark_node *node, cmark_event_type ev_type,
case CMARK_NODE_LINK:
if (entering) {
cmark_strbuf_puts(html, "<a href=\"");
- escape_href(html, node->as.link.url.data,
- node->as.link.url.len);
+ houdini_escape_href(html, node->as.link.url.data,
+ node->as.link.url.len);
if (node->as.link.title.len) {
cmark_strbuf_puts(html, "\" title=\"");
@@ -279,8 +268,8 @@ S_render_node(cmark_node *node, cmark_event_type ev_type,
case CMARK_NODE_IMAGE:
if (entering) {
cmark_strbuf_puts(html, "<img src=\"");
- escape_href(html, node->as.link.url.data,
- node->as.link.url.len);
+ houdini_escape_href(html, node->as.link.url.data,
+ node->as.link.url.len);
cmark_strbuf_puts(html, "\" alt=\"");
state->plain = node;