>> mbrtowc(NULL, NULL, 0, &ps);
>> crashes.
> This is a bug in your program, not in glibc. Add
> memset(&ps, 0, sizeof(ps));
> to initialize the state with zero, as required by the ISO C standard.
I expected the answer would be something like this.
Bruno's man page says
A third case is when s is NULL. In this case, pwc and n
are ignored. The mbrtowc function puts *ps in the initial
state and returns 0.
I'll change the man page to
A third case is when s is NULL. In this case, pwc and n
are ignored and the call is equivalent to
mbrtowc(NULL, "", 1, ps);
In all of the above cases, if ps is a NULL pointer, a
static anonymous state only known to the mbrtowc function
is used instead. Otherwise, the object of type mbstate_t
it points to must have been initialized. It is initialized
to the initial conversion state by zeroing it.
Andries
--
Linux-UTF8: i18n of Linux on all levels
Archive: http://mail.nl.linux.org/linux-utf8/