-
Notifications
You must be signed in to change notification settings - Fork 8.2k
libc: minimal: add missing ctype.h functions #99451
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
libc: minimal: add missing ctype.h functions #99451
Conversation
Add the functions below to the minimal libc ctype.h since they are missing, and are required as of C89 (C99 for `isblank()`) * `isblank()` * `islower()` * `ispunct()` Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
32d89a3 to
2960508
Compare
|
|
| return (int)((c == (int)' ') || (c == (int)'\t')); | ||
| } | ||
|
|
||
| static inline int isspace(int c) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd let the compiler do something cute if it likes, but express these in a direct fashion.
static inline int isspace (int c)
{
return c == ' ' || ('\t' <= c && c <= '\r');
}
Similarly for the other functions. There's no reason to obscure what these functions do; having to check that there are 5 'blank' values between '\t' and '\r' is something the compiler should do, not us.
keith-packard
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please express these directly rather than using arithmetic.



Add the functions below to the minimal libc
ctype.hsince they are missing, and are required as of C89 (C99 forisblank())isblank()islower()ispunct()Fixes #99452