summaryrefslogtreecommitdiff
path: root/utf8.h
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2021-06-30 18:27:12 -0600
committerKarl Williamson <khw@cpan.org>2021-08-14 09:44:57 -0600
commit5fd26678bf8c8b48b9fdad829c928780cd445d2e (patch)
treed1e751d5a595c15f4079d320f9bf58fd41d87109 /utf8.h
parent27099574415e78f6fc05276c1c8cb07cd825fe35 (diff)
downloadperl-5fd26678bf8c8b48b9fdad829c928780cd445d2e.tar.gz
Improve utf16_to_utf8_reversed()
Instead of destroying the input by first swapping the bytes, this calls a base function with the order to use. The non-reverse function is changed to call the base function with the non-reversed order.
Diffstat (limited to 'utf8.h')
-rw-r--r--utf8.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/utf8.h b/utf8.h
index e85e14bc07..bc6aa2083b 100644
--- a/utf8.h
+++ b/utf8.h
@@ -82,6 +82,11 @@ the string is invariant.
#define utf8n_to_uvchr_error(s, len, lenp, flags, errors) \
utf8n_to_uvchr_msgs(s, len, lenp, flags, errors, 0)
+#define utf16_to_utf8(p, d, bytelen, newlen) \
+ utf16_to_utf8_base(p, d, bytelen, newlen, 0, 1)
+#define utf16_to_utf8_reversed(p, d, bytelen, newlen) \
+ utf16_to_utf8_base(p, d, bytelen, newlen, 1, 0)
+
#define to_uni_fold(c, p, lenp) _to_uni_fold_flags(c, p, lenp, FOLD_FLAGS_FULL)
#define foldEQ_utf8(s1, pe1, l1, u1, s2, pe2, l2, u2) \