aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-03-21 16:30:18 -0400
committerBruce Hill <bruce@bruce-hill.com>2025-03-21 16:30:18 -0400
commite599a5de39f1e5185bc038f5789938c72d9ef1b6 (patch)
tree8a38b55260c72860e5670a3dcc5911a6b7eb3e60
parentac3a02b80bf78c4212eab930243c1a2e0ca9c728 (diff)
Add version check for uc_is_property_prepended_concatenation_mark(),
which was instroduced in libunistring v1.2
-rw-r--r--stdlib/text.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/stdlib/text.c b/stdlib/text.c
index 966f6ac3..bfaa0581 100644
--- a/stdlib/text.c
+++ b/stdlib/text.c
@@ -61,11 +61,12 @@
#include <stdlib.h>
#include <sys/param.h>
-#include <unistr.h>
#include <unicase.h>
#include <unictype.h>
#include <unigbrk.h>
#include <uniname.h>
+#include <unistr.h>
+#include <unistring/version.h>
#include <uniwidth.h>
#include "arrays.h"
@@ -206,8 +207,12 @@ public int32_t get_synthetic_grapheme(const ucs4_t *codepoints, int64_t utf32_le
// that begin with *prefix* modifiers, so we gotta check for that case:
synthetic_graphemes[-grapheme_id-1].main_codepoint = length_prefixed[1];
for (ucs4_t i = 0; i < utf32_len; i++) {
+#if _LIBUNISTRING_VERSION >= 0x010200
+// libuinstring version 1.2.0 introduced uc_is_property_prepended_concatenation_mark()
+// It's not critical, but it's technically more correct to have this check:
if (unlikely(uc_is_property_prepended_concatenation_mark(length_prefixed[1+i])))
continue;
+#endif
synthetic_graphemes[-grapheme_id-1].main_codepoint = length_prefixed[1+i];
break;
}