cmark

My personal build of CMark ✏️

Commit
c698cdcbd2e61f91059479bc18c8f3ca4da62fb7
Parent
57a756462f30d7f2f03c8d8de9ea874cf9536fa9
Author
John MacFarlane <jgm@berkeley.edu>
Date

Merge pull request #5 from nwellnhof/zap_strnlen

Don't rely on strnlen being available

Diffstat

2 files changed, 5 insertions, 2 deletions

Status File Name N° Changes Insertions Deletions
Modified src/CMakeLists.txt 2 1 1
Modified src/houdini_html_u.c 5 4 1
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
@@ -136,7 +136,7 @@ if(MSVC)
   endif()
   set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4127 /wd4244 /wd4267 /wd4706 /wd4800 /D_CRT_SECURE_NO_WARNINGS")
 elseif(CMAKE_COMPILER_IS_GNUCC OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
-  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -std=c99 -pedantic -D_GNU_SOURCE")
+  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -std=c99 -pedantic")
 endif()
 
 # Compile as C++ under MSVC
diff --git a/src/houdini_html_u.c b/src/houdini_html_u.c
@@ -55,7 +55,10 @@ houdini_unescape_ent(cmark_strbuf *ob, const uint8_t *src, size_t size)
 				const struct html_ent *entity = find_entity((char *)src, i);
 
 				if (entity != NULL) {
-					size_t len = strnlen((const char *)entity->utf8, 4);
+					int len = 0;
+					while (len < 4 && entity->utf8[len] != '\0') {
+						++len;
+					}
 					cmark_strbuf_put(ob, entity->utf8, len);
 					return i + 1;
 				}