2008-07-21 Jeff Johnston <jjohnstn@redhat.com>

* libc/ctype/ctype_.c: Add new pointer __ctype_ptr__ which is one
        less than the old __ctype_ptr.
        * libc/ctype/isalnum.c: Use __ctype_ptr__.
        * libc/ctype/isalpha.c: Ditto.
        * libc/ctype/iscntrl.c: Ditto.
        * libc/ctype/isdigit.c: Ditto.
        * libc/ctype/islower.c: Ditto.
        * libc/ctype/isprint.c: Ditto.
        * libc/ctype/ispunct.c: Ditto.
        * libc/ctype/isspace.c: Ditto.
        * libc/ctype/isupper.c: Ditto.
        * libc/ctype/isxdigit.c: Ditto.
        * libc/include/ctype.h: Change ctype macros to use new __ctype_ptr__
        and add declaration of __ctype_ptr__.  Remove older ctype table pointers
        from here even though they can still work.
This commit is contained in:
Jeff Johnston 2008-07-21 21:28:34 +00:00
parent 0485c2ceec
commit fa914bf8ab
13 changed files with 44 additions and 24 deletions

View File

@ -1,3 +1,21 @@
2008-07-21 Jeff Johnston <jjohnstn@redhat.com>
* libc/ctype/ctype_.c: Add new pointer __ctype_ptr__ which is one
less than the old __ctype_ptr.
* libc/ctype/isalnum.c: Use __ctype_ptr__.
* libc/ctype/isalpha.c: Ditto.
* libc/ctype/iscntrl.c: Ditto.
* libc/ctype/isdigit.c: Ditto.
* libc/ctype/islower.c: Ditto.
* libc/ctype/isprint.c: Ditto.
* libc/ctype/ispunct.c: Ditto.
* libc/ctype/isspace.c: Ditto.
* libc/ctype/isupper.c: Ditto.
* libc/ctype/isxdigit.c: Ditto.
* libc/include/ctype.h: Change ctype macros to use new __ctype_ptr__
and add declaration of __ctype_ptr__. Remove older ctype table pointers
from here even though they can still work.
2008-07-18 Ken Werner <ken.werner@de.ibm.com> 2008-07-18 Ken Werner <ken.werner@de.ibm.com>
* libc/machine/spu/strcpy.h: Fix error in previous patch. * libc/machine/spu/strcpy.h: Fix error in previous patch.

View File

@ -86,8 +86,10 @@ static _CONST char _ctype_b[128 + 256] = {
# if defined(__CYGWIN__) # if defined(__CYGWIN__)
_CONST char __declspec(dllexport) *__ctype_ptr = _ctype_b + 128; _CONST char __declspec(dllexport) *__ctype_ptr = _ctype_b + 128;
_CONST char __declspec(dllexport) *__ctype_ptr__ = _ctype_b + 127;
# else # else
_CONST char *__ctype_ptr = _ctype_b + 128; _CONST char *__ctype_ptr = _ctype_b + 128;
_CONST char *__ctype_ptr__ = _ctype_b + 127;
# endif # endif
# if defined(_HAVE_ARRAY_ALIASING) # if defined(_HAVE_ARRAY_ALIASING)
@ -124,4 +126,5 @@ _CONST char _ctype_[1 + 256] = {
}; };
_CONST char *__ctype_ptr = _ctype_ + 1; _CONST char *__ctype_ptr = _ctype_ + 1;
_CONST char *__ctype_ptr__ = _ctype_;
#endif #endif

View File

@ -41,6 +41,6 @@ No OS subroutines are required.
int int
_DEFUN(isalnum,(c),int c) _DEFUN(isalnum,(c),int c)
{ {
return((_ctype_ + 1)[c] & (_U|_L|_N)); return(__ctype_ptr__[c+1] & (_U|_L|_N));
} }

View File

@ -39,6 +39,6 @@ No supporting OS subroutines are required.
int int
_DEFUN(isalpha,(c),int c) _DEFUN(isalpha,(c),int c)
{ {
return((_ctype_ + 1)[c] & (_U|_L)); return(__ctype_ptr__[c+1] & (_U|_L));
} }

View File

@ -42,7 +42,7 @@ No supporting OS subroutines are required.
int int
_DEFUN(iscntrl,(c),int c) _DEFUN(iscntrl,(c),int c)
{ {
return((_ctype_ + 1)[c] & _C); return(__ctype_ptr__[c+1] & _C);
} }

View File

@ -39,5 +39,5 @@ No supporting OS subroutines are required.
int int
_DEFUN(isdigit,(c),int c) _DEFUN(isdigit,(c),int c)
{ {
return((_ctype_ + 1)[c] & _N); return(__ctype_ptr__[c+1] & _N);
} }

View File

@ -38,6 +38,6 @@ No supporting OS subroutines are required.
int int
_DEFUN(islower,(c),int c) _DEFUN(islower,(c),int c)
{ {
return((_ctype_ + 1)[c] & _L); return(__ctype_ptr__[c+1] & _L);
} }

View File

@ -47,7 +47,7 @@ No supporting OS subroutines are required.
int int
_DEFUN(isgraph,(c),int c) _DEFUN(isgraph,(c),int c)
{ {
return((_ctype_ + 1)[c] & (_P|_U|_L|_N)); return(__ctype_ptr__[c+1] & (_P|_U|_L|_N));
} }
@ -55,6 +55,6 @@ _DEFUN(isgraph,(c),int c)
int int
_DEFUN(isprint,(c),int c) _DEFUN(isprint,(c),int c)
{ {
return((_ctype_ + 1)[c] & (_P|_U|_L|_N|_B)); return(__ctype_ptr__[c+1] & (_P|_U|_L|_N|_B));
} }

View File

@ -41,6 +41,6 @@ No supporting OS subroutines are required.
int int
_DEFUN(ispunct,(c),int c) _DEFUN(ispunct,(c),int c)
{ {
return((_ctype_ + 1)[c] & _P); return(__ctype_ptr__[c+1] & _P);
} }

View File

@ -39,6 +39,6 @@ No supporting OS subroutines are required.
int int
_DEFUN(isspace,(c),int c) _DEFUN(isspace,(c),int c)
{ {
return((_ctype_ + 1)[c] & _S); return(__ctype_ptr__[c+1] & _S);
} }

View File

@ -38,6 +38,6 @@ No supporting OS subroutines are required.
int int
_DEFUN(isupper,(c),int c) _DEFUN(isupper,(c),int c)
{ {
return((_ctype_ + 1)[c] & _U); return(__ctype_ptr__[c+1] & _U);
} }

View File

@ -40,6 +40,6 @@ No supporting OS subroutines are required.
int int
_DEFUN(isxdigit,(c),int c) _DEFUN(isxdigit,(c),int c)
{ {
return((_ctype_ + 1)[c] & ((_X)|(_N))); return(__ctype_ptr__[c+1] & ((_X)|(_N)));
} }

View File

@ -36,21 +36,20 @@ int _EXFUN(_toupper, (int __c));
#define _X 0100 #define _X 0100
#define _B 0200 #define _B 0200
extern __IMPORT _CONST char *__ctype_ptr; extern __IMPORT _CONST char *__ctype_ptr__;
extern __IMPORT _CONST char _ctype_[]; /* For backward compatibility. */
#ifndef __cplusplus #ifndef __cplusplus
#define isalpha(c) ((__ctype_ptr)[(unsigned)(c)]&(_U|_L)) #define isalpha(c) ((__ctype_ptr__)[(unsigned)((c)+1)]&(_U|_L))
#define isupper(c) ((__ctype_ptr)[(unsigned)(c)]&_U) #define isupper(c) ((__ctype_ptr__)[(unsigned)((c)+1)]&_U)
#define islower(c) ((__ctype_ptr)[(unsigned)(c)]&_L) #define islower(c) ((__ctype_ptr__)[(unsigned)((c)+1)]&_L)
#define isdigit(c) ((__ctype_ptr)[(unsigned)(c)]&_N) #define isdigit(c) ((__ctype_ptr__)[(unsigned)((c)+1)]&_N)
#define isxdigit(c) ((__ctype_ptr)[(unsigned)(c)]&(_X|_N)) #define isxdigit(c) ((__ctype_ptr__)[(unsigned)((c)+1)]&(_X|_N))
#define isspace(c) ((__ctype_ptr)[(unsigned)(c)]&_S) #define isspace(c) ((__ctype_ptr__)[(unsigned)((c)+1)]&_S)
#define ispunct(c) ((__ctype_ptr)[(unsigned)(c)]&_P) #define ispunct(c) ((__ctype_ptr__)[(unsigned)((c)+1)]&_P)
#define isalnum(c) ((__ctype_ptr)[(unsigned)(c)]&(_U|_L|_N)) #define isalnum(c) ((__ctype_ptr__)[(unsigned)((c)+1)]&(_U|_L|_N))
#define isprint(c) ((__ctype_ptr)[(unsigned)(c)]&(_P|_U|_L|_N|_B)) #define isprint(c) ((__ctype_ptr__)[(unsigned)((c)+1)]&(_P|_U|_L|_N|_B))
#define isgraph(c) ((__ctype_ptr)[(unsigned)(c)]&(_P|_U|_L|_N)) #define isgraph(c) ((__ctype_ptr__)[(unsigned)((c)+1)]&(_P|_U|_L|_N))
#define iscntrl(c) ((__ctype_ptr)[(unsigned)(c)]&_C) #define iscntrl(c) ((__ctype_ptr__)[(unsigned)((c)+1)]&_C)
/* Non-gcc versions will get the library versions, and will be /* Non-gcc versions will get the library versions, and will be