Restore ctype(3) ABI forward compatibility in 6.x world. This was broken

with last ctype(3) single-byte and multi-byte separation for fixing
operating on UTF-8 locale. To be specific, we introduced a new symbol in
libc. And this symbol is referred via inline functions here. So, you can
not run a binary built with this version of libc on an older system. To
restore the compatibility, make these functions built as non-inlined
form (see lib/libc/nomarco.c) and MFC rev 1.32 which drops the usage of
that symbol in question for __isctype(). As this may impact performance,
I only intend to fix in 6.x, but not 7 (not yet released) and 8 (it's HEAD).

Discussed on:	cvs-src
Requested by:	scottl
Reviewed by:	ache, delphij
Approved by:	re (kensmith)
This commit is contained in:
rafan 2007-10-30 01:30:42 +00:00
parent 33d1852e9a
commit 2b868cc2c2

View File

@ -97,6 +97,19 @@ extern int __mb_sb_limit;
#include <runetype.h>
/*
* These four use the __mb_sb_limit symbol which breaks RELENG_6's
* forward compatibility after 602113. Force them built as non-inlined
* form to recover.
*/
#ifndef _EXTERNALIZE_CTYPE_INLINES_
__BEGIN_DECLS
int __sbmaskrune(__ct_rune_t, unsigned long);
__ct_rune_t __sbtoupper(__ct_rune_t);
__ct_rune_t __sbtolower(__ct_rune_t);
__END_DECLS
#endif
static __inline int
__maskrune(__ct_rune_t _c, unsigned long _f)
{
@ -104,12 +117,14 @@ __maskrune(__ct_rune_t _c, unsigned long _f)
_CurrentRuneLocale->__runetype[_c]) & _f;
}
#ifdef _EXTERNALIZE_CTYPE_INLINES_
static __inline int
__sbmaskrune(__ct_rune_t _c, unsigned long _f)
{
return (_c < 0 || _c >= __mb_sb_limit) ? 0 :
_CurrentRuneLocale->__runetype[_c] & _f;
}
#endif
static __inline int
__istype(__ct_rune_t _c, unsigned long _f)
@ -126,7 +141,7 @@ __sbistype(__ct_rune_t _c, unsigned long _f)
static __inline int
__isctype(__ct_rune_t _c, unsigned long _f)
{
return (_c < 0 || _c >= __mb_sb_limit) ? 0 :
return (_c & ~0x7F) ? 0 :
!!(_DefaultRuneLocale.__runetype[_c] & _f);
}
@ -137,12 +152,14 @@ __toupper(__ct_rune_t _c)
_CurrentRuneLocale->__mapupper[_c];
}
#ifdef _EXTERNALIZE_CTYPE_INLINES_
static __inline __ct_rune_t
__sbtoupper(__ct_rune_t _c)
{
return (_c < 0 || _c >= __mb_sb_limit) ? _c :
_CurrentRuneLocale->__mapupper[_c];
}
#endif
static __inline __ct_rune_t
__tolower(__ct_rune_t _c)
@ -151,12 +168,14 @@ __tolower(__ct_rune_t _c)
_CurrentRuneLocale->__maplower[_c];
}
#ifdef _EXTERNALIZE_CTYPE_INLINES_
static __inline __ct_rune_t
__sbtolower(__ct_rune_t _c)
{
return (_c < 0 || _c >= __mb_sb_limit) ? _c :
_CurrentRuneLocale->__maplower[_c];
}
#endif
static __inline int
__wcwidth(__ct_rune_t _c)