/* Convert multibyte character to wide character.
- Copyright (C) 1999-2002, 2005-2010 Free Software Foundation, Inc.
+ Copyright (C) 1999-2002, 2005-2011 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2008.
This program is free software: you can redistribute it and/or modify
size_t
rpl_mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)
{
-# if MBRTOWC_NULL_ARG_BUG || MBRTOWC_RETVAL_BUG
+# if MBRTOWC_NULL_ARG2_BUG || MBRTOWC_RETVAL_BUG
if (s == NULL)
{
pwc = NULL;
return ret;
}
# else
- return mbrtowc (pwc, s, n, ps);
+ {
+# if MBRTOWC_NULL_ARG1_BUG
+ wchar_t dummy;
+
+ if (pwc == NULL)
+ pwc = &dummy;
+# endif
+
+ return mbrtowc (pwc, s, n, ps);
+ }
# endif
}