From: Bruno Haible Date: Sun, 16 Jul 2023 05:30:57 +0000 (+0200) Subject: quotearg: Optimize clearing an mbstate_t. X-Git-Tag: v1.0~1091 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=a85a9b34bd5ccd4cfe2f0c3c445199a91517814a;p=gnulib.git quotearg: Optimize clearing an mbstate_t. * lib/quotearg.c: Include . (quotearg_buffer_restyled): Use mbszero. * modules/quotearg (Depends-on): Add mbszero. --- diff --git a/ChangeLog b/ChangeLog index bf52c82001..7371228547 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2023-07-16 Bruno Haible + + quotearg: Optimize clearing an mbstate_t. + * lib/quotearg.c: Include . + (quotearg_buffer_restyled): Use mbszero. + * modules/quotearg (Depends-on): Add mbszero. + 2023-07-16 Bruno Haible vasnprintf, vasnwprintf: Optimize clearing an mbstate_t. diff --git a/lib/quotearg.c b/lib/quotearg.c index 5b26055b2e..8e500d9b67 100644 --- a/lib/quotearg.c +++ b/lib/quotearg.c @@ -42,6 +42,7 @@ #include #include #include +#include #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; diff --git a/modules/quotearg b/modules/quotearg index 6e823fa9c6..89f81fd55f 100644 --- a/modules/quotearg +++ b/modules/quotearg @@ -13,6 +13,7 @@ c-strcaseeq c32isprint extensions gettext-h +mbszero mbrtoc32 mbsinit memcmp