diff options
| author | Jörg Frings-Fürst <debian@jff.email> | 2026-03-08 17:28:33 +0100 |
|---|---|---|
| committer | Jörg Frings-Fürst <debian@jff.email> | 2026-03-08 17:28:33 +0100 |
| commit | 5f59a34ab747dde8ede7357f3431bf06bd6002fe (patch) | |
| tree | 056a4477fd870d454d5be5868cddab829a47f4d2 /lib/mbrtowc-impl.h | |
| parent | 27dae84ed92f1ef0300263091972338d12e78348 (diff) | |
New upstream version 1.4.2upstream/1.4.2upstream
Diffstat (limited to 'lib/mbrtowc-impl.h')
| -rw-r--r-- | lib/mbrtowc-impl.h | 29 |
1 files changed, 15 insertions, 14 deletions
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. |
