From 5f59a34ab747dde8ede7357f3431bf06bd6002fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Sun, 8 Mar 2026 17:28:33 +0100 Subject: New upstream version 1.4.2 --- lib/mbrtowc-impl.h | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) (limited to 'lib/mbrtowc-impl.h') diff --git a/lib/mbrtowc-impl.h b/lib/mbrtowc-impl.h index 61be6599..21a3998c 100644 --- a/lib/mbrtowc-impl.h +++ b/lib/mbrtowc-impl.h @@ -1,5 +1,5 @@ /* Convert multibyte character to wide character. - Copyright (C) 1999-2002, 2005-2025 Free Software Foundation, Inc. + Copyright (C) 1999-2002, 2005-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -41,8 +41,6 @@ char buf[4]; const char *p; size_t m; - enc_t enc; - int res; switch (nstate) { @@ -75,7 +73,8 @@ /* Here m > 0. */ - enc = locale_encoding_classification (); + enc_t enc = locale_encoding_classification (); + int res; if (enc == enc_utf8) /* UTF-8 */ { @@ -89,17 +88,19 @@ { /* The hidden internal state of mbtowc would make this function not multi-thread safe. Achieve multi-thread safety through a lock. */ - wchar_t wc; - res = mbtowc_with_lock (&wc, p, m); + { + wchar_t wc; + res = mbtowc_with_lock (&wc, p, m); - if (res >= 0) - { - if ((wc == 0) != (res == 0)) - abort (); - if (pwc != NULL) - *pwc = wc; - goto success; - } + if (res >= 0) + { + if ((wc == 0) != (res == 0)) + abort (); + if (pwc != NULL) + *pwc = wc; + goto success; + } + } /* mbtowc does not distinguish between invalid and incomplete multibyte sequences. But mbrtowc needs to make this distinction. -- cgit v1.2.3