Rename MD4C_USE_UNICODE to MD4C_USE_UTF8.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
diff --git a/README.md b/README.md
index c34a9e7..212d8a9 100644
--- a/README.md
+++ b/README.md
@@ -122,7 +122,7 @@ unchanged.
The behavior of MD4C in the isolated situations where the encoding really
matters is determined by preprocessor macros:
- * If preprocessor macro `MD4C_USE_UNICODE` is defined, MD4C assumes UTF-8
+ * If preprocessor macro `MD4C_USE_UTF8` is defined, MD4C assumes UTF-8
in the specific situations.
* On Windows, if preprocessor macro `MD4C_USE_WIN_UNICODE` is defined, MD4C
diff --git a/md4c/CMakeLists.txt b/md4c/CMakeLists.txt
index 6267d3e..f9577a3 100644
--- a/md4c/CMakeLists.txt
+++ b/md4c/CMakeLists.txt
@@ -1,6 +1,6 @@
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DDEBUG")
-add_definitions(-DMD4C_USE_UNICODE)
+add_definitions(-DMD4C_USE_UTF8)
add_library(md4c STATIC md4c.c md4c.h)
diff --git a/md4c/md4c.c b/md4c/md4c.c
index db220a6..9631729 100644
--- a/md4c/md4c.c
+++ b/md4c/md4c.c
@@ -432,7 +432,7 @@ struct MD_UNICODE_FOLD_INFO_tag {
};
-#if defined MD4C_USE_WIN_UNICODE || defined MD4C_USE_UNICODE
+#if defined MD4C_USE_WIN_UNICODE || defined MD4C_USE_UTF8
static int
md_is_unicode_whitespace__(int codepoint)
{
@@ -731,7 +731,7 @@ struct MD_UNICODE_FOLD_INFO_tag {
{
return md_decode_utf16le__(str+off, str_size-off, p_char_size);
}
-#elif defined MD4C_USE_UNICODE
+#elif defined MD4C_USE_UTF8
#define IS_UTF8_LEAD1(byte) ((unsigned char)(byte) <= 0x7f)
#define IS_UTF8_LEAD2(byte) (((unsigned char)(byte) & 0xe0) == 0xc0)
#define IS_UTF8_LEAD3(byte) (((unsigned char)(byte) & 0xf0) == 0xe0)