summaryrefslogtreecommitdiff
path: root/lib/mbrtowc-impl.h
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff.email>2026-03-08 17:28:50 +0100
committerJörg Frings-Fürst <debian@jff.email>2026-03-08 17:28:50 +0100
commitff33e1d252f46bec1a33e28700da3282fc24047a (patch)
tree5c15bc695be820b393a8496c5807ecafbbdeb89b /lib/mbrtowc-impl.h
parentb2ac982cc8b5290699eb5f52fb043d3d15e2624b (diff)
parent5f59a34ab747dde8ede7357f3431bf06bd6002fe (diff)
Update upstream source from tag 'upstream/1.4.2'
Update to upstream version '1.4.2' with Debian dir 493e96bcd865e4f9990e20bee26408c96231d727
Diffstat (limited to 'lib/mbrtowc-impl.h')
-rw-r--r--lib/mbrtowc-impl.h29
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.