summaryrefslogtreecommitdiff
path: root/src/commonmark.c
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2015-03-29 23:09:59 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2015-03-29 23:09:59 -0700
commit2efddb2c78bc161e71b7e4f609b8377b05c57c04 (patch)
tree104fa8bf4a76ba35a9b566ae725a8ca392fce917 /src/commonmark.c
parent8a04d10c5570231baa4326817d7f10f8f1f04a57 (diff)
commonmark - use strlen not strnlen for portability.
strlen should be safe here, as we use it on strings generated by cmark_chunk_to_cstr and these should be null terminated.
Diffstat (limited to 'src/commonmark.c')
-rw-r--r--src/commonmark.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/commonmark.c b/src/commonmark.c
index dcf2e63..23faa7c 100644
--- a/src/commonmark.c
+++ b/src/commonmark.c
@@ -249,7 +249,7 @@ is_autolink(cmark_node *node)
title = cmark_node_get_title(node);
// if it has a title, we can't treat it as an autolink:
- if (title != NULL && strnlen(title, 1) > 0) {
+ if (title != NULL && strlen(title) > 0) {
return false;
}
cmark_consolidate_text_nodes(node);
@@ -351,7 +351,7 @@ S_render_node(cmark_node *node, cmark_event_type ev_type,
list_delim == CMARK_PAREN_DELIM ?
")" : ".",
list_number < 10 ? " " : " ");
- marker_width = strnlen(listmarker, 63);
+ marker_width = strlen(listmarker);
}
if (entering) {
if (cmark_node_get_list_type(node->parent) ==
@@ -392,7 +392,7 @@ S_render_node(cmark_node *node, cmark_event_type ev_type,
// use indented form if no info, and code doesn't
// begin or end with a blank line, and code isn't
// first thing in a list item
- if ((info == NULL || strnlen(info, 1) == 0) &&
+ if ((info == NULL || strlen(info) == 0) &&
(code->len > 2 &&
!isspace(code->data[0]) &&
!(isspace(code->data[code->len - 1]) &&
@@ -534,7 +534,7 @@ S_render_node(cmark_node *node, cmark_event_type ev_type,
cmark_chunk_literal(cmark_node_get_url(node)),
false, URL);
title = cmark_node_get_title(node);
- if (title && strnlen(title, 1) > 0) {
+ if (title && strlen(title) > 0) {
lit(state, " \"", true);
out(state, cmark_chunk_literal(title),
false, TITLE);
@@ -552,7 +552,7 @@ S_render_node(cmark_node *node, cmark_event_type ev_type,
lit(state, "](", false);
out(state, cmark_chunk_literal(cmark_node_get_url(node)), false, URL);
title = cmark_node_get_title(node);
- if (title && strnlen(title, 1) > 0) {
+ if (title && strlen(title) > 0) {
lit(state, " \"", true);
out(state, cmark_chunk_literal(title), false, TITLE);
lit(state, "\"", false);