--- mingw-w64-crt/stdio/mingw_pformat.c | 21 +++++++-------------- mingw-w64-crt/stdio/mingw_sformat.c | 10 ++++------ mingw-w64-crt/stdio/mingw_swformat.c | 10 +++++----- mingw-w64-crt/stdio/mingw_vfscanf.c | 4 +--- mingw-w64-crt/stdio/mingw_vfwscanf.c | 4 +--- mingw-w64-crt/stdio/mingw_vsscanf.c | 5 +---- mingw-w64-crt/stdio/mingw_vswscanf.c | 5 +---- 7 files changed, 20 insertions(+), 39 deletions(-)
diff --git a/mingw-w64-crt/stdio/mingw_pformat.c b/mingw-w64-crt/stdio/mingw_pformat.c index fd53ce1a8..d094e7ace 100644 --- a/mingw-w64-crt/stdio/mingw_pformat.c +++ b/mingw-w64-crt/stdio/mingw_pformat.c @@ -512,8 +512,7 @@ void __pformat_putchars( const char *s, int count, __pformat_t *stream ) wchar_t w[12], *p; while( count > 0 ) { - mbstate_t ps; - memset(&ps, 0, sizeof(ps) ); + mbstate_t ps = {0}; --count; p = &w[0]; l = mbrtowc (p, s, strlen (s), &ps); @@ -1175,11 +1174,8 @@ void __pformat_emit_radix_point( __pformat_t *stream ) /* Radix point initialisation not yet completed; * establish a multibyte to `wchar_t' converter... */ - int len; wchar_t rpchr; mbstate_t state; - - /* Initialise the conversion state... - */ - memset( &state, 0, sizeof( state ) ); + int len; wchar_t rpchr; + mbstate_t state = {0}; /* Fetch and convert the localised radix point representation... */ @@ -1203,11 +1199,8 @@ void __pformat_emit_radix_point( __pformat_t *stream ) #ifdef __BUILD_WIDEAPI __pformat_putc (stream->rpchr, stream); #else - int len; char buf[len = stream->rplen]; mbstate_t state; - - /* Initialise the conversion state... - */ - memset( &state, 0, sizeof( state ) ); + int len; char buf[len = stream->rplen]; + mbstate_t state = {0}; /* Convert the `wchar_t' representation to multibyte... */ @@ -3123,8 +3116,8 @@ __pformat (int flags, void *dest, int max, const APICHAR *fmt, va_list argv) if (state == PFORMAT_INIT) { stream.flags |= PFORMAT_GROUPED; /* $$$$ */ - int len; wchar_t rpchr; mbstate_t cstate; - memset (&cstate, 0, sizeof(state)); + int len; wchar_t rpchr; + mbstate_t cstate = {0}; if ((len = mbrtowc( &rpchr, localeconv()->thousands_sep, 16, &cstate)) > 0) stream.thousands_chr = rpchr; stream.thousands_chr_len = len; diff --git a/mingw-w64-crt/stdio/mingw_sformat.c b/mingw-w64-crt/stdio/mingw_sformat.c index 040c2ae88..81757cb1e 100644 --- a/mingw-w64-crt/stdio/mingw_sformat.c +++ b/mingw-w64-crt/stdio/mingw_sformat.c @@ -307,7 +307,7 @@ __mingw_sformat (_IFP *s, const char *format, va_list argp) char seen_dot, seen_exp, is_neg, not_in; char *tmp_wbuf_ptr, buf[MB_LEN_MAX]; const char *lc_decimal_point, *lc_thousands_sep; - mbstate_t state, cstate; + mbstate_t state = {0}, cstate; union { unsigned long long ull; unsigned long ul; @@ -323,8 +323,6 @@ __mingw_sformat (_IFP *s, const char *format, va_list argp) return EOF; } - memset (&state, 0, sizeof (state)); - lc_decimal_point = localeconv()->decimal_point; lc_thousands_sep = localeconv()->thousands_sep; if (lc_thousands_sep != NULL && *lc_thousands_sep == 0) @@ -682,7 +680,7 @@ __mingw_sformat (_IFP *s, const char *format, va_list argp) if ((c = in_ch (s, &read_in)) == EOF) return cleanup_return ((!rval ? EOF : rval), &gcollect, pstr, &wbuf); - memset (&cstate, 0, sizeof (cstate)); + cstate = (mbstate_t){0}; do { @@ -854,7 +852,7 @@ __mingw_sformat (_IFP *s, const char *format, va_list argp) if ((c = in_ch (s, &read_in)) == EOF) return cleanup_return ((!rval ? EOF : rval), &gcollect, pstr, &wbuf); - memset (&cstate, 0, sizeof (cstate)); + cstate = (mbstate_t){0}; do { @@ -1459,7 +1457,7 @@ __mingw_sformat (_IFP *s, const char *format, va_list argp) if ((c = in_ch (s, &read_in)) == EOF) return cleanup_return ((!rval ? EOF : rval), &gcollect, pstr, &wbuf); - memset (&cstate, 0, sizeof (cstate)); + cstate = (mbstate_t){0}; do { diff --git a/mingw-w64-crt/stdio/mingw_swformat.c b/mingw-w64-crt/stdio/mingw_swformat.c index 5f4b2c08f..6cc354cc9 100644 --- a/mingw-w64-crt/stdio/mingw_swformat.c +++ b/mingw-w64-crt/stdio/mingw_swformat.c @@ -332,10 +332,10 @@ __mingw_swformat (_IFPW *s, const wchar_t *format, va_list argp) return EOF; } - memset (&state, 0, sizeof(state)); + state = (mbstate_t){0}; clen = mbrtowc( &wc, localeconv()->decimal_point, 16, &state); lc_decimal_point = (clen > 0 ? wc : '.'); - memset( &state, 0, sizeof( state ) ); + state = (mbstate_t){0}; clen = mbrtowc( &wc, localeconv()->thousands_sep, 16, &state); lc_thousands_sep = (clen > 0 ? wc : 0); @@ -596,7 +596,7 @@ __mingw_swformat (_IFPW *s, const wchar_t *format, va_list argp) if ((c = in_ch (s, &read_in)) == WEOF) return cleanup_return ((!rval ? EOF : rval), &gcollect, pstr, &wbuf); - memset (&state, 0, sizeof (state)); + state = (mbstate_t){0}; do { @@ -744,7 +744,7 @@ __mingw_swformat (_IFPW *s, const wchar_t *format, va_list argp) if ((c = in_ch (s, &read_in)) == WEOF) return cleanup_return ((!rval ? EOF : rval), &gcollect, pstr, &wbuf); - memset (&state, 0, sizeof (state)); + state = (mbstate_t){0}; do { @@ -1459,7 +1459,7 @@ __mingw_swformat (_IFPW *s, const wchar_t *format, va_list argp) if ((c = in_ch (s, &read_in)) == WEOF) return cleanup_return ((!rval ? EOF : rval), &gcollect, pstr, &wbuf); - memset (&state, 0, sizeof (state)); + state = (mbstate_t){0}; do { diff --git a/mingw-w64-crt/stdio/mingw_vfscanf.c b/mingw-w64-crt/stdio/mingw_vfscanf.c index eadc9be32..2d1814ef5 100644 --- a/mingw-w64-crt/stdio/mingw_vfscanf.c +++ b/mingw-w64-crt/stdio/mingw_vfscanf.c @@ -7,8 +7,6 @@ int __mingw_vfscanf (FILE *s, const char *format, va_list argp) { - _IFP ifp; - memset (&ifp, 0, sizeof (_IFP)); - ifp.fp = s; + _IFP ifp = { .fp = s }; return __mingw_sformat (&ifp, format, argp); } diff --git a/mingw-w64-crt/stdio/mingw_vfwscanf.c b/mingw-w64-crt/stdio/mingw_vfwscanf.c index dfb156f6d..ddfe47a85 100644 --- a/mingw-w64-crt/stdio/mingw_vfwscanf.c +++ b/mingw-w64-crt/stdio/mingw_vfwscanf.c @@ -7,8 +7,6 @@ int __mingw_vfwscanf (FILE *s, const wchar_t *format, va_list argp) { - _IFPW ifp; - memset (&ifp, 0, sizeof (_IFPW)); - ifp.fp = s; + _IFPW ifp = { .fp = s }; return __mingw_swformat (&ifp, format, argp); } diff --git a/mingw-w64-crt/stdio/mingw_vsscanf.c b/mingw-w64-crt/stdio/mingw_vsscanf.c index 52d72d9f0..9bff45841 100644 --- a/mingw-w64-crt/stdio/mingw_vsscanf.c +++ b/mingw-w64-crt/stdio/mingw_vsscanf.c @@ -7,9 +7,6 @@ int __mingw_vsscanf (const char *s, const char *format, va_list argp) { - _IFP ifp; - memset (&ifp, 0, sizeof (_IFP)); - ifp.str = s; - ifp.is_string = 1; + _IFP ifp = { .str = s, .is_string = 1 }; return __mingw_sformat (&ifp, format, argp); } diff --git a/mingw-w64-crt/stdio/mingw_vswscanf.c b/mingw-w64-crt/stdio/mingw_vswscanf.c index 48767f229..9f23837f7 100644 --- a/mingw-w64-crt/stdio/mingw_vswscanf.c +++ b/mingw-w64-crt/stdio/mingw_vswscanf.c @@ -7,9 +7,6 @@ int __mingw_vswscanf (const wchar_t *s, const wchar_t *format, va_list argp) { - _IFPW ifp; - memset (&ifp, 0, sizeof (_IFPW)); - ifp.str = s; - ifp.is_string = 1; + _IFPW ifp = { .str = s, .is_string = 1 }; return __mingw_swformat (&ifp, format, argp); } -- 2.48.1 _______________________________________________ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public