1
0
mirror of https://https.git.savannah.gnu.org/git/gnulib.git synced 2026-09-01 02:34:55 +00:00

btoc32: Optimize clearing an mbstate_t.

* lib/btoc32.c: Include <wchar.h>.
(btoc32): Use mbszero.
* modules/btoc32 (Depends-on): Add mbszero.
This commit is contained in:
Bruno Haible
2023-07-16 07:30:27 +02:00
parent c05bdfe0d5
commit 9ca0b47c2a
3 changed files with 10 additions and 1 deletions
+7
View File
@@ -1,3 +1,10 @@
2023-07-16 Bruno Haible <bruno@clisp.org>
btoc32: Optimize clearing an mbstate_t.
* lib/btoc32.c: Include <wchar.h>.
(btoc32): Use mbszero.
* modules/btoc32 (Depends-on): Add mbszero.
2023-07-16 Bruno Haible <bruno@clisp.org>
btowc: Optimize clearing an mbstate_t.
+2 -1
View File
@@ -24,6 +24,7 @@
#include <stdio.h>
#include <string.h>
#include <wchar.h>
#if GL_CHAR32_T_IS_UNICODE
# include "lc-charset-unicode.h"
@@ -44,7 +45,7 @@ btoc32 (int c)
char s[1];
char32_t wc;
memset (&state, '\0', sizeof (mbstate_t));
mbszero (&state);
s[0] = (unsigned char) c;
if (mbrtoc32 (&wc, s, 1, &state) <= 1)
return wc;
+1
View File
@@ -6,6 +6,7 @@ lib/btoc32.c
Depends-on:
uchar
mbszero
mbrtoc32
btowc