From 7ca98b490133315b2b999c56eff604b655f062c0 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Thu, 26 Mar 2009 09:45:11 +0000 Subject: [PATCH] * libc/ctype/ctype_.c (_CTYPE_DATA_0_127): Mark TAB as blank character. * libc/ctype/isblank.c: Replace hardcoded test with test for having _B marker in ctype array. * libc/include/ctype.h (isblank): Add macro. --- newlib/ChangeLog | 7 +++++++ newlib/libc/ctype/ctype_.c | 2 +- newlib/libc/ctype/isblank.c | 2 +- newlib/libc/include/ctype.h | 4 ++++ 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/newlib/ChangeLog b/newlib/ChangeLog index 7ab9ba1d4..a964578b8 100644 --- a/newlib/ChangeLog +++ b/newlib/ChangeLog @@ -1,3 +1,10 @@ +2009-03-26 Corinna Vinschen + + * libc/ctype/ctype_.c (_CTYPE_DATA_0_127): Mark TAB as blank character. + * libc/ctype/isblank.c: Replace hardcoded test with test for having _B + marker in ctype array. + * libc/include/ctype.h (isblank): Add macro. + 2009-03-25 Craig Howland * libc/include/math.h: (llround, llroundf): Declare. diff --git a/newlib/libc/ctype/ctype_.c b/newlib/libc/ctype/ctype_.c index 6fa30b207..71756431b 100644 --- a/newlib/libc/ctype/ctype_.c +++ b/newlib/libc/ctype/ctype_.c @@ -39,7 +39,7 @@ static char sccsid[] = "@(#)ctype_.c 5.6 (Berkeley) 6/1/90"; #define _CTYPE_DATA_0_127 \ _C, _C, _C, _C, _C, _C, _C, _C, \ - _C, _C|_S, _C|_S, _C|_S, _C|_S, _C|_S, _C, _C, \ + _C, _B|_C|_S, _C|_S, _C|_S, _C|_S, _C|_S, _C, _C, \ _C, _C, _C, _C, _C, _C, _C, _C, \ _C, _C, _C, _C, _C, _C, _C, _C, \ _S|_B, _P, _P, _P, _P, _P, _P, _P, \ diff --git a/newlib/libc/ctype/isblank.c b/newlib/libc/ctype/isblank.c index 3e124d8f7..0567b40b9 100644 --- a/newlib/libc/ctype/isblank.c +++ b/newlib/libc/ctype/isblank.c @@ -37,5 +37,5 @@ No supporting OS subroutines are required. int _DEFUN(isblank,(c),int c) { - return (c == ' ' || c == '\t'); + return(__ctype_ptr__[c+1] & _B); } diff --git a/newlib/libc/include/ctype.h b/newlib/libc/include/ctype.h index a7c7ca2ef..74cfb6f23 100644 --- a/newlib/libc/include/ctype.h +++ b/newlib/libc/include/ctype.h @@ -54,6 +54,10 @@ extern __IMPORT _CONST char *__ctype_ptr__; #define isgraph(c) ((__ctype_ptr__)[(unsigned)((c)+1)]&(_P|_U|_L|_N)) #define iscntrl(c) ((__ctype_ptr__)[(unsigned)((c)+1)]&_C) +#if !defined(__STRICT_ANSI__) || __STDC_VERSION__ >= 199901L +#define isblank(c) ((__ctype_ptr__)[(unsigned)((c)+1)]&_B) +#endif + /* Non-gcc versions will get the library versions, and will be slightly slower */