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

ChangeLog
lib/quotearg.c
modules/quotearg

index bf52c82001d63eb90cdd20e4d0c3e0e0964edbe6..7371228547dcb14cfca217717f4bf7dfd238e36e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2023-07-16  Bruno Haible  <bruno@clisp.org>
+
+       quotearg: Optimize clearing an mbstate_t.
+       * lib/quotearg.c: Include <wchar.h>.
+       (quotearg_buffer_restyled): Use mbszero.
+       * modules/quotearg (Depends-on): Add mbszero.
+
 2023-07-16  Bruno Haible  <bruno@clisp.org>
 
        vasnprintf, vasnwprintf: Optimize clearing an mbstate_t.
index 5b26055b2e551abf566df0b95c10b3610dc0c14a..8e500d9b67755f770894955fd6dd52b98559b184 100644 (file)
@@ -42,6 +42,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <uchar.h>
+#include <wchar.h>
 
 #include "gettext.h"
 #define _(msgid) gettext (msgid)
@@ -607,7 +608,7 @@ quotearg_buffer_restyled (char *buffer, size_t buffersize,
             else
               {
                 mbstate_t mbstate;
-                memset (&mbstate, 0, sizeof mbstate);
+                mbszero (&mbstate);
 
                 m = 0;
                 printable = true;
index 6e823fa9c60814dcec336afde54b64dbd482f647..89f81fd55fd9a0e75cf4b044c90630be3234f678 100644 (file)
@@ -13,6 +13,7 @@ c-strcaseeq
 c32isprint
 extensions
 gettext-h
+mbszero
 mbrtoc32
 mbsinit
 memcmp