mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-21 22:51:37 +00:00
Add isblank
Existing ctype checks are implemented using a 256 byte lookup table, allowing each character to be in any of 8 character classes. Since there are 8 existing character classes without the blank class, I implemented isblank without using the lookup table. Since there are only two blank characters - tab and space - this is a more reasonable approach than doubling the size of the lookup table to accommodate one more class. Signed-off-by: Jason Hobbs <jason.hobbs@calxeda.com>
This commit is contained in:
parent
c8a2079e49
commit
93337abbfe
1 changed files with 6 additions and 0 deletions
|
@ -31,6 +31,12 @@ extern const unsigned char _ctype[];
|
||||||
#define isupper(c) ((__ismask(c)&(_U)) != 0)
|
#define isupper(c) ((__ismask(c)&(_U)) != 0)
|
||||||
#define isxdigit(c) ((__ismask(c)&(_D|_X)) != 0)
|
#define isxdigit(c) ((__ismask(c)&(_D|_X)) != 0)
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Rather than doubling the size of the _ctype lookup table to hold a 'blank'
|
||||||
|
* flag, just check for space or tab.
|
||||||
|
*/
|
||||||
|
#define isblank(c) (c == ' ' || c == '\t')
|
||||||
|
|
||||||
#define isascii(c) (((unsigned char)(c))<=0x7f)
|
#define isascii(c) (((unsigned char)(c))<=0x7f)
|
||||||
#define toascii(c) (((unsigned char)(c))&0x7f)
|
#define toascii(c) (((unsigned char)(c))&0x7f)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue