X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fmbsrtowcs-state.c;h=35045f657412534e98047afcbfcb914974a2d321;hb=b48afd89ec9be56156d6e2bebfdf457c778fe5c3;hp=3b4db21e0056b0940fa6aaf38e9ebb55b713ccb3;hpb=8d557bc3528230c6567d3a90633dc23b2de170a8;p=gnulib.git diff --git a/lib/mbsrtowcs-state.c b/lib/mbsrtowcs-state.c index 3b4db21e0..35045f657 100644 --- a/lib/mbsrtowcs-state.c +++ b/lib/mbsrtowcs-state.c @@ -1,5 +1,5 @@ /* Convert string to wide string. - Copyright (C) 2008-2009 Free Software Foundation, Inc. + Copyright (C) 2008-2010 Free Software Foundation, Inc. Written by Bruno Haible , 2008. This program is free software: you can redistribute it and/or modify @@ -20,4 +20,18 @@ #include /* Internal state used by the functions mbsrtowcs() and mbsnrtowcs(). */ -mbstate_t _gl_mbsrtowcs_state = 0; +mbstate_t _gl_mbsrtowcs_state +/* The state must initially be in the "initial state"; so, zero-initialize it. + On most systems, putting it into BSS is sufficient. Not so on MacOS X 10.3, + see . + When it needs an initializer, use 0 or {0} as initializer? 0 only works + when mbstate_t is a scalar type (such as when gnulib defines it, or on + AIX, IRIX, mingw). {0} works as an initializer in all cases: for a struct + or union type, but also for a scalar type (ISO C 99, 6.7.8.(11)). */ +#if defined __ELF__ + /* On ELF systems, variables in BSS behave well. */ +#else + /* Use braces, to be on the safe side. */ + = { 0 } +#endif + ;