diff options
| author | Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> | 2026-03-26 12:53:53 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-03-26 12:53:53 +0100 |
| commit | 13e14a6bfd9f29cbfeab0c5161d2a994f97532e7 (patch) | |
| tree | 3aa7186fe092e42783dc7e981dc39a74ea61c466 /gl/mbrtowc-impl.h | |
| parent | 9d8503f90ef25b2cecd324dc118e441f40233ea8 (diff) | |
| download | monitoring-plugins-13e14a6bfd9f29cbfeab0c5161d2a994f97532e7.tar.gz | |
* Sync with the 202601-stable Gnulib code (4a3650d887)
* Ignore more deps stuff in gnulib
* Remove autogenerated gnulib files
* Ignore more gnulib generated headers
Diffstat (limited to 'gl/mbrtowc-impl.h')
| -rw-r--r-- | gl/mbrtowc-impl.h | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/gl/mbrtowc-impl.h b/gl/mbrtowc-impl.h index 61be6599..21a3998c 100644 --- a/gl/mbrtowc-impl.h +++ b/gl/mbrtowc-impl.h | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* Convert multibyte character to wide character. | 1 | /* Convert multibyte character to wide character. |
| 2 | Copyright (C) 1999-2002, 2005-2025 Free Software Foundation, Inc. | 2 | Copyright (C) 1999-2002, 2005-2026 Free Software Foundation, Inc. |
| 3 | 3 | ||
| 4 | This file is free software: you can redistribute it and/or modify | 4 | This file is free software: you can redistribute it and/or modify |
| 5 | it under the terms of the GNU Lesser General Public License as | 5 | it under the terms of the GNU Lesser General Public License as |
| @@ -41,8 +41,6 @@ | |||
| 41 | char buf[4]; | 41 | char buf[4]; |
| 42 | const char *p; | 42 | const char *p; |
| 43 | size_t m; | 43 | size_t m; |
| 44 | enc_t enc; | ||
| 45 | int res; | ||
| 46 | 44 | ||
| 47 | switch (nstate) | 45 | switch (nstate) |
| 48 | { | 46 | { |
| @@ -75,7 +73,8 @@ | |||
| 75 | 73 | ||
| 76 | /* Here m > 0. */ | 74 | /* Here m > 0. */ |
| 77 | 75 | ||
| 78 | enc = locale_encoding_classification (); | 76 | enc_t enc = locale_encoding_classification (); |
| 77 | int res; | ||
| 79 | 78 | ||
| 80 | if (enc == enc_utf8) /* UTF-8 */ | 79 | if (enc == enc_utf8) /* UTF-8 */ |
| 81 | { | 80 | { |
| @@ -89,17 +88,19 @@ | |||
| 89 | { | 88 | { |
| 90 | /* The hidden internal state of mbtowc would make this function not | 89 | /* The hidden internal state of mbtowc would make this function not |
| 91 | multi-thread safe. Achieve multi-thread safety through a lock. */ | 90 | multi-thread safe. Achieve multi-thread safety through a lock. */ |
| 92 | wchar_t wc; | 91 | { |
| 93 | res = mbtowc_with_lock (&wc, p, m); | 92 | wchar_t wc; |
| 93 | res = mbtowc_with_lock (&wc, p, m); | ||
| 94 | 94 | ||
| 95 | if (res >= 0) | 95 | if (res >= 0) |
| 96 | { | 96 | { |
| 97 | if ((wc == 0) != (res == 0)) | 97 | if ((wc == 0) != (res == 0)) |
| 98 | abort (); | 98 | abort (); |
| 99 | if (pwc != NULL) | 99 | if (pwc != NULL) |
| 100 | *pwc = wc; | 100 | *pwc = wc; |
| 101 | goto success; | 101 | goto success; |
| 102 | } | 102 | } |
| 103 | } | ||
| 103 | 104 | ||
| 104 | /* mbtowc does not distinguish between invalid and incomplete multibyte | 105 | /* mbtowc does not distinguish between invalid and incomplete multibyte |
| 105 | sequences. But mbrtowc needs to make this distinction. | 106 | sequences. But mbrtowc needs to make this distinction. |
