From a686d047d79bdfc37c096a4fa350c37e4ccf3cf5 Mon Sep 17 00:00:00 2001 From: Jakob Kaivo Date: Mon, 3 Jun 2024 13:56:25 -0400 Subject: add LC_CTYPE epoch and use separate CT_ categories and CTM_ masks to support detecting change of LC_CTYPE between calls to wctype()/iswctype() and wctrans()/towctrans() --- src/wctype/towctrans.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/wctype/towctrans.c') diff --git a/src/wctype/towctrans.c b/src/wctype/towctrans.c index 8e6d266c..4dccfa64 100644 --- a/src/wctype/towctrans.c +++ b/src/wctype/towctrans.c @@ -8,6 +8,10 @@ wint_t towctrans(wint_t wc, wctrans_t desc) ASSERT_REPRESENTABLE(wc, WCHAR_MIN, WCHAR_MAX, "wchar_t", WEOF); //ASSERT_REPRESENTABLE(desc, 1, __libc.wctype.nwctrans, "wctrans_t", 0); + if (__get_locale()->ctype_epoch != (desc >> CT_EPOCH_SHIFT)) { + UNDEFINED("LC_CTYPE has changed since the call to wctrans()"); + } + /* TODO: actual work */ (void)wc; (void)desc; -- cgit v1.2.1