Bruno Haible <[EMAIL PROTECTED]> wrote:
> pathchk.c:203: warning: missing braces around initializer
> pathchk.c:203: warning: (near initialization for `mbstate.__mbstate8')
>
> Here the problem is:
> mbstate_t mbstate = {0};
> ISO C 99 guarantees only that mbstate_t is not an array type; it could
> be a scalar or pointer type. The fix is therefore to use an initialization
> through memset, as in mbswidth.c and quotearg.c.
Thanks again.
Applied:
2006-10-09 Jim Meyering <[EMAIL PROTECTED]>
Avoid a compiler warning.
* src/pathchk.c (portable_chars_only): Initialize variable of type
mbstate_t via memset, rather than via '{0}'. Patch from Bruno Haible.
Index: src/pathchk.c
===================================================================
RCS file: /fetish/cu/src/pathchk.c,v
retrieving revision 1.88
diff -u -r1.88 pathchk.c
--- src/pathchk.c 30 May 2005 07:05:07 -0000 1.88
+++ src/pathchk.c 9 Oct 2006 11:52:26 -0000
@@ -1,5 +1,5 @@
/* pathchk -- check whether file names are valid or portable
- Copyright (C) 1991-2005 Free Software Foundation, Inc.
+ Copyright (C) 1991-2006 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -200,8 +200,11 @@
if (*invalid)
{
- mbstate_t mbstate = {0};
- size_t charlen = mbrlen (invalid, filelen - validlen, &mbstate);
+ mbstate_t mbstate;
+ size_t charlen;
+
+ memset (&mbstate, 0, sizeof mbstate);
+ charlen = mbrlen (invalid, filelen - validlen, &mbstate);
error (0, 0,
_("nonportable character %s in file name %s"),
quotearg_n_style_mem (1, locale_quoting_style, invalid,
_______________________________________________
Bug-coreutils mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-coreutils