]> Savannah Git Hosting - gnulib.git/commitdiff
mbswidth: Optimize clearing an mbstate_t.
authorBruno Haible <bruno@clisp.org>
Sun, 16 Jul 2023 05:30:50 +0000 (07:30 +0200)
committerBruno Haible <bruno@clisp.org>
Sun, 16 Jul 2023 08:29:19 +0000 (10:29 +0200)
* lib/mbswidth.c (mbsnwidth): Use mbszero.
* modules/mbswidth (Depends-on): Add mbszero.

ChangeLog
lib/mbswidth.c
modules/mbswidth

index 946725e139d42063b08a8652eff31fa4310715f0..49d27cc084addb00cd9f0c0bfa659eb7751b2f98 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2023-07-16  Bruno Haible  <bruno@clisp.org>
+
+       mbswidth: Optimize clearing an mbstate_t.
+       * lib/mbswidth.c (mbsnwidth): Use mbszero.
+       * modules/mbswidth (Depends-on): Add mbszero.
+
 2023-07-16  Bruno Haible  <bruno@clisp.org>
 
        mbfile: Optimize clearing an mbstate_t.
index a1613dcad6fd3e15262766b789524ec6c1c469d5..9ce94ae80d028e961fa1eed444c4fe24c5e24fdf 100644 (file)
@@ -94,7 +94,7 @@ mbsnwidth (const char *string, size_t nbytes, int flags)
               /* If we have a multibyte sequence, scan it up to its end.  */
               {
                 mbstate_t mbstate;
-                memset (&mbstate, 0, sizeof mbstate);
+                mbszero (&mbstate);
                 for (;;)
                   {
                     char32_t wc;
index 4dd8c55ee4fc891c72d9655b3b278ac453a19ef4..3c2e17dc0625a2fab98e5e444ca7d8aa699c7e47 100644 (file)
@@ -13,6 +13,7 @@ wchar
 uchar
 mbrtoc32
 mbsinit
+mbszero
 c32width
 c32iscntrl
 extensions