Page MenuHomeFreeBSD

D41985.diff
No OneTemporary

D41985.diff

diff --git a/include/_ctype.h b/include/_ctype.h
--- a/include/_ctype.h
+++ b/include/_ctype.h
@@ -92,8 +92,6 @@
#define __inline
#endif
-extern int __mb_sb_limit;
-
/*
* Use inline functions if we are allowed to and the compiler supports them.
*/
@@ -102,6 +100,15 @@
#include <runetype.h>
+#ifndef _LOCALE_T_DEFINED
+#define _LOCALE_T_DEFINED
+typedef struct _xlocale *locale_t;
+#endif
+
+__BEGIN_DECLS
+_RuneLocale *__runes_for_locale(locale_t, int *);
+__END_DECLS
+
static __inline int
__maskrune(__ct_rune_t _c, unsigned long _f)
{
@@ -112,7 +119,10 @@
static __inline int
__sbmaskrune(__ct_rune_t _c, unsigned long _f)
{
- return (_c < 0 || _c >= __mb_sb_limit) ? 0 :
+ int __limit;
+
+ (void) __runes_for_locale((locale_t)-2, &__limit);
+ return (_c < 0 || _c >= __limit) ? 0 :
_CurrentRuneLocale->__runetype[_c] & _f;
}
@@ -145,7 +155,10 @@
static __inline __ct_rune_t
__sbtoupper(__ct_rune_t _c)
{
- return (_c < 0 || _c >= __mb_sb_limit) ? _c :
+ int __limit;
+
+ (void) __runes_for_locale((locale_t)-2, &__limit);
+ return (_c < 0 || _c >= __limit) ? _c :
_CurrentRuneLocale->__mapupper[_c];
}
@@ -159,7 +172,10 @@
static __inline __ct_rune_t
__sbtolower(__ct_rune_t _c)
{
- return (_c < 0 || _c >= __mb_sb_limit) ? _c :
+ int __limit;
+
+ (void) __runes_for_locale((locale_t)-2, &__limit);
+ return (_c < 0 || _c >= __limit) ? _c :
_CurrentRuneLocale->__maplower[_c];
}
diff --git a/include/xlocale/_ctype.h b/include/xlocale/_ctype.h
--- a/include/xlocale/_ctype.h
+++ b/include/xlocale/_ctype.h
@@ -38,17 +38,11 @@
#define _XLOCALE_CTYPE_H
#endif
-#ifndef _LOCALE_T_DEFINED
-#define _LOCALE_T_DEFINED
-typedef struct _xlocale *locale_t;
-#endif
-
#ifndef _XLOCALE_RUN_FUNCTIONS_DEFINED
#define _XLOCALE_RUN_FUNCTIONS_DEFINED 1
unsigned long ___runetype_l(__ct_rune_t, locale_t) __pure;
__ct_rune_t ___tolower_l(__ct_rune_t, locale_t) __pure;
__ct_rune_t ___toupper_l(__ct_rune_t, locale_t) __pure;
-_RuneLocale *__runes_for_locale(locale_t, int*);
#endif
#ifndef _XLOCALE_INLINE
diff --git a/lib/libc/locale/xlocale_private.h b/lib/libc/locale/xlocale_private.h
--- a/lib/libc/locale/xlocale_private.h
+++ b/lib/libc/locale/xlocale_private.h
@@ -208,7 +208,7 @@
}
/**
- * Two magic values are allowed for locale_t objects. NULL and -1. This
+ * Three magic values are allowed for locale_t objects. NULL, -1, and -2. This
* function maps those to the real locales that they represent.
*/
static inline locale_t get_real_locale(locale_t locale)
@@ -216,6 +216,7 @@
switch ((intptr_t)locale) {
case 0: return (&__xlocale_C_locale);
case -1: return (&__xlocale_global_locale);
+ case -2: return (__get_locale());
default: return (locale);
}
}

File Metadata

Mime Type
text/plain
Expires
Mon, Jan 19, 5:53 PM (14 h, 28 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
27749694
Default Alt Text
D41985.diff (2 KB)

Event Timeline