summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/stdlib.h3
-rw-r--r--src/internal/locale_impl.h3
2 files changed, 5 insertions, 1 deletions
diff --git a/include/stdlib.h b/include/stdlib.h
index 97ce5a72..d2c911fc 100644
--- a/include/stdlib.h
+++ b/include/stdlib.h
@@ -76,7 +76,8 @@ size_t wcstombs (char *__restrict, const wchar_t *__restrict, size_t);
#define EXIT_FAILURE 1
#define EXIT_SUCCESS 0
-#define MB_CUR_MAX ((size_t)+4)
+size_t __ctype_get_mb_cur_max(void);
+#define MB_CUR_MAX (__ctype_get_mb_cur_max())
#define RAND_MAX (0x7fffffff)
diff --git a/src/internal/locale_impl.h b/src/internal/locale_impl.h
index 85db7933..f5e4d9b4 100644
--- a/src/internal/locale_impl.h
+++ b/src/internal/locale_impl.h
@@ -34,4 +34,7 @@ const char *__lctrans_cur(const char *);
#define CURRENT_UTF8 (!!__pthread_self()->locale->cat[LC_CTYPE])
+#undef MB_CUR_MAX
+#define MB_CUR_MAX (CURRENT_UTF8 ? 4 : 1)
+
#endif