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:
@@ -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
@@ -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;
|
||||
|
||||
@@ -6,6 +6,7 @@ lib/btoc32.c
|
||||
|
||||
Depends-on:
|
||||
uchar
|
||||
mbszero
|
||||
mbrtoc32
|
||||
btowc
|
||||
|
||||
|
||||
Reference in New Issue
Block a user