diff options
Diffstat (limited to 'src/stdlib/_stdlib.h')
-rw-r--r-- | src/stdlib/_stdlib.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/stdlib/_stdlib.h b/src/stdlib/_stdlib.h index 7edb9d98..d5f89b09 100644 --- a/src/stdlib/_stdlib.h +++ b/src/stdlib/_stdlib.h @@ -3,8 +3,22 @@ #include <stdlib.h> #include <limits.h> +#include "locale/_locale.h" #include "_safety.h" +#ifndef NDEBUG +#define ASSERT_CTYPE(__s_ptr) do { \ + static unsigned int __ctype_epoch = 0; \ + if ((__s_ptr) == 0) { \ + __ctype_epoch = __get_ctype_epoch(); \ + } else if (__ctype_epoch != __get_ctype_epoch()) { \ + UNDEFINED("LC_CTYPE has changed since previous call which did not reset internal state"); \ + } \ +} while (0) +#else +#define ASSERT_CTYPE(__s_ptr) (void)(__s_ptr) +#endif + #ifdef NEED_COMPAR #ifdef NDEBUG #define SAFE_COMPAR(__comp, __p1, __p2, __sz, __fn) __comp(__p1, __p2) |