diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2009-04-02 07:53:12 +0000 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2009-04-02 07:53:12 +0000 |
commit | 72c79be10e56764fe57300814537cd474f50e43d (patch) | |
tree | 089036e09da17c5963ddd49b4d21fa7697ba5302 /newlib | |
parent | cd767078de5138e10c177506fc29a8721f7e7c3b (diff) | |
download | newlib-72c79be10e56764fe57300814537cd474f50e43d.zip newlib-72c79be10e56764fe57300814537cd474f50e43d.tar.gz newlib-72c79be10e56764fe57300814537cd474f50e43d.tar.bz2 |
* libc/ctype/ctype_c.c: Move inclusion of ctype_iso.h and
ctype_cp.h out of ALLOW_NEGATIVE_CTYPE_INDEX case.
(__ctype_ptr__): Constify in !_MB_CAPABLE case. Otherwise,
de-constify in !ALLOW_NEGATIVE_CTYPE_INDEX case, too. Add comment.
(__set_ctype): Set __ctype_ptr__ pointer according to definition
of ALLOW_NEGATIVE_CTYPE_INDEX.
* libc/include/ctype.h (__ctype_ptr__): Constify in !_MB_CAPABLE case.
Diffstat (limited to 'newlib')
-rw-r--r-- | newlib/ChangeLog | 10 | ||||
-rw-r--r-- | newlib/libc/ctype/ctype_.c | 43 | ||||
-rw-r--r-- | newlib/libc/include/ctype.h | 3 |
3 files changed, 45 insertions, 11 deletions
diff --git a/newlib/ChangeLog b/newlib/ChangeLog index bcd3367..789d460 100644 --- a/newlib/ChangeLog +++ b/newlib/ChangeLog @@ -1,3 +1,13 @@ +2009-04-02 Corinna Vinschen <corinna@vinschen.de> + + * libc/ctype/ctype_c.c: Move inclusion of ctype_iso.h and + ctype_cp.h out of ALLOW_NEGATIVE_CTYPE_INDEX case. + (__ctype_ptr__): Constify in !_MB_CAPABLE case. Otherwise, + de-constify in !ALLOW_NEGATIVE_CTYPE_INDEX case, too. Add comment. + (__set_ctype): Set __ctype_ptr__ pointer according to definition + of ALLOW_NEGATIVE_CTYPE_INDEX. + * libc/include/ctype.h (__ctype_ptr__): Constify in !_MB_CAPABLE case. + 2009-03-31 Corinna Vinschen <corinna@vinschen.de> * libc/ctype/Makefile.am: Remove _tolower.c and _toupper.c diff --git a/newlib/libc/ctype/ctype_.c b/newlib/libc/ctype/ctype_.c index f5d5300..4efdfa4 100644 --- a/newlib/libc/ctype/ctype_.c +++ b/newlib/libc/ctype/ctype_.c @@ -77,6 +77,15 @@ static char sccsid[] = "@(#)ctype_.c 5.6 (Berkeley) 6/1/90"; #define ALLOW_NEGATIVE_CTYPE_INDEX #endif +#if defined(_MB_CAPABLE) +#if defined(_MB_EXTENDED_CHARSETS_ISO) +#include "ctype_iso.h" +#endif +#if defined(_MB_EXTENDED_CHARSETS_WINDOWS) +#include "ctype_cp.h" +#endif +#endif + #if defined(ALLOW_NEGATIVE_CTYPE_INDEX) /* No static const on Cygwin since it's referenced and potentially overwritten for compatibility with older applications. */ @@ -89,16 +98,10 @@ char _ctype_b[128 + 256] = { _CTYPE_DATA_128_256 }; -#if defined(_MB_CAPABLE) -#if defined(_MB_EXTENDED_CHARSETS_ISO) -#include "ctype_iso.h" -#endif -#if defined(_MB_EXTENDED_CHARSETS_WINDOWS) -#include "ctype_cp.h" +#ifndef _MB_CAPABLE +_CONST #endif -#endif - -char __EXPORT *__ctype_ptr__ = _ctype_b + 127; +char __EXPORT *__ctype_ptr__ = (char *) _ctype_b + 127; # ifdef __CYGWIN__ @@ -120,7 +123,7 @@ _CONST char _ctype_[1 + 256] = { _CTYPE_DATA_0_127, _CTYPE_DATA_128_256 }; -# endif /* !_HAVE_ARRAY_ALIASING */ +# endif /* !_HAVE_ARRAY_ALIASING */ #else /* !defined(ALLOW_NEGATIVE_CTYPE_INDEX) */ @@ -130,7 +133,11 @@ _CONST char _ctype_[1 + 256] = { _CTYPE_DATA_128_256 }; -_CONST char *__ctype_ptr__ = _ctype_; +#ifndef _MB_CAPABLE +_CONST +#endif +char *__ctype_ptr__ = (char *) _ctype_; + #endif #if defined(_MB_CAPABLE) @@ -140,7 +147,9 @@ _CONST char *__ctype_ptr__ = _ctype_; void __set_ctype (const char *charset) { +#if defined(_MB_EXTENDED_CHARSETS_ISO) || defined(_MB_EXTENDED_CHARSETS_WINDOWS) int idx; +#endif switch (*charset) { @@ -154,7 +163,11 @@ __set_ctype (const char *charset) idx = 0; else ++idx; +# if defined(ALLOW_NEGATIVE_CTYPE_INDEX) __ctype_ptr__ = (char *) (__ctype_iso[idx] + 127); +# else + __ctype_ptr__ = (char *) __ctype_iso[idx]; +# endif return; #endif #if defined(_MB_EXTENDED_CHARSETS_WINDOWS) @@ -162,13 +175,21 @@ __set_ctype (const char *charset) idx = __cp_index (charset + 2); if (idx < 0) break; +# if defined(ALLOW_NEGATIVE_CTYPE_INDEX) __ctype_ptr__ = (char *) (__ctype_cp[idx] + 127); +# else + __ctype_ptr__ = (char *) __ctype_cp[idx]; +# endif return; #endif default: break; } +# if defined(ALLOW_NEGATIVE_CTYPE_INDEX) __ctype_ptr__ = (char *) _ctype_b + 127; +# else + __ctype_ptr__ = (char *) _ctype_; +# endif } #endif /* !__CYGWIN__ */ #endif /* _MB_CAPABLE */ diff --git a/newlib/libc/include/ctype.h b/newlib/libc/include/ctype.h index b99115a..d223dd0 100644 --- a/newlib/libc/include/ctype.h +++ b/newlib/libc/include/ctype.h @@ -39,6 +39,9 @@ int _EXFUN(toascii, (int __c)); #define _X 0100 #define _B 0200 +#ifndef _MB_CAPABLE +_CONST +#endif extern __IMPORT char *__ctype_ptr__; #ifndef __cplusplus |