[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] mbsrtowcs-state.c, wcsrtombs-state.c: avoid compilation fail

From: Jim Meyering
Subject: Re: [PATCH] mbsrtowcs-state.c, wcsrtombs-state.c: avoid compilation failure
Date: Tue, 28 Apr 2009 16:57:30 +0200

Eric Blake wrote:

> Jim Meyering <jim <at> meyering.net> writes:
>> @@ -20,4 +20,4 @@
>>  #include <wchar.h>
>>  /* Internal state used by the functions mbsrtowcs() and mbsnrtowcs().  */
>> -mbstate_t _gl_mbsrtowcs_state = 0;
>> +mbstate_t _gl_mbsrtowcs_state = { 0, };
> Is this correct for all platforms?  If I read Posix correctly, mbstate_t can 
> be
> a numeric type rather than a struct.

Good point.
Maybe we can use something like this instead:

    static mbstate_t _dummy;
    mbstate_t _gl_mbsrtowcs_state = _dummy;

> But this declaration is at global scope.  Why use an initializer at all, when
> this should work regardless of the underlying type?
> mbstate_t _gl_mbsrtowcs_state;

See his earlier commit:

2009-01-25  Bruno Haible  <address@hidden>

        Avoid link errors on MacOS X 10.3.
        * lib/mbsrtowcs-state.c (_gl_mbsrtowcs_state): Add initializer.
        * lib/wcsrtombs-state.c (_gl_wcsrtombs_state): Likewise.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]