* lib/mbsinit.c (mbsinit): When the argument is NULL, return 1.
* tests/test-mbsinit.c (mbsinit): Check this behaviour.
+2011-02-13 Bruno Haible <bruno@clisp.org>
+
+ mbsinit: Don't crash for a NULL argument.
+ * lib/mbsinit.c (mbsinit): When the argument is NULL, return 1.
+ * tests/test-mbsinit.c (mbsinit): Check this behaviour.
+
2011-02-13 Bruno Haible <bruno@clisp.org>
Don't interfere with a program's definition of __attribute__.
{
const char *pstate = (const char *)ps;
- return pstate[0] == 0;
+ return pstate == NULL || pstate[0] == 0;
}
{
static mbstate_t state;
+ ASSERT (mbsinit (NULL));
+
ASSERT (mbsinit (&state));
if (argc > 1)