# undef c99_trunc
#endif
-#ifdef WIN32
+#ifdef _MSC_VER
/* Some APIs exist under Win32 with "underbar" names. */
# undef c99_hypot
#endif
CODE:
#if defined(USE_ITHREADS) && defined(HAS_MBRLEN)
- PERL_UNUSED_RESULT(mbrlen(NULL, 0, &ps)); /* Initialize state */
+ memset(&ps, 0, sizeof(ps)); /* Initialize state */
RETVAL = mbrlen(s, n, &ps); /* Prefer reentrant version */
#else
+ /* This might prevent some races, but locales can be switched out
+ * without locking, so this isn't a cure all */
+ LOCALE_LOCK;
+
RETVAL = mblen(s, n);
+ LOCALE_UNLOCK;
#endif
OUTPUT:
RETVAL
#else /* If can't check directly, at least can see if script is consistent,
under UTF-8, which gives us an extra measure of confidence. */
- && isSCRIPT_RUN((const U8 *) buf, buf + len,
+ && isSCRIPT_RUN((const U8 *) buf,
+ (const U8 *) buf + len,
TRUE) /* Means assume UTF-8 */
#endif
)) {