AC_CHECK_FUNCS(posix_memalign memalign valloc)
AC_CHECK_FUNCS(getopt getopt_long getopt_long_only)
AC_CHECK_FUNCS(fls flsl flsll ffs ffsl ffsll)
-AC_CHECK_FUNCS(fnmatch)
+AC_CHECK_FUNCS(fnmatch mbsnrtowcs)
### Functions provided only on win32
AC_CHECK_FUNCS(localtime_r gettimeofday recvmsg sendmsg usleep getrusage)
### Functions used by libusual itself
wchar_t *wbuf, int wbuf_len, bool allow_invalid)
{
mbstate_t ps;
- int clen, wcnt;
+ int clen;
wchar_t *dst, *w, *wend;
const char *s;
const char *str_end;
return NULL;
}
+#ifdef HAVE_MBSNRTOWCS
/* try full decode at once */
s = str;
memset(&ps, 0, sizeof(ps));
- wcnt = mbsnrtowcs(dst, &s, str_len, wmax, &ps);
- if (wcnt > 0 && s == NULL) {
+ clen = mbsnrtowcs(dst, &s, str_len, wmax, &ps);
+ if (clen > 0 && s == NULL) {
if (wlen_p)
- *wlen_p = wcnt;
+ *wlen_p = clen;
return dst;
}
+#endif
/* full decode failed, decode chars one-by-one */
s = str;