From 86fda06897ccd4d610410f920923c6e1f3e2bf3d Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Mon, 29 Dec 2014 22:15:09 -0800 Subject: Added cmark_ctype.h with locale-independent isspace, ispunct, etc. Otherwise cmark's behavior varies unpredictably with the locale. `is_punctuation` in utf8.h has also been adjusted so that everything that counts all ASCII symbol characters count as punctuation, even though some are not in P* character classes. --- src/utf8.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) (limited to 'src/utf8.c') diff --git a/src/utf8.c b/src/utf8.c index 8e3c4bb..50d8834 100644 --- a/src/utf8.c +++ b/src/utf8.c @@ -2,6 +2,7 @@ #include #include +#include "cmark_ctype.h" #include "utf8.h" static const int8_t utf8proc_utf8class[256] = { @@ -268,17 +269,7 @@ int utf8proc_is_space(int32_t uc) // matches anything in the P[cdefios] classes. int utf8proc_is_punctuation(int32_t uc) { - return ((uc >= 33 && uc <= 35) || - (uc >= 37 && uc <= 42) || - (uc >= 44 && uc <= 47) || - uc == 58 || - uc == 59 || - uc == 63 || - uc == 64 || - (uc >= 91 && uc <= 93) || - uc == 95 || - uc == 123 || - uc == 125 || + return ((uc < 128 && ispunct((char)uc)) || uc == 161 || uc == 167 || uc == 171 || -- cgit v1.2.3