This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH/RFA] Fix ctype table and isblank


Corinna,

Yes, we really should have an "alpha" flag AND a "blank" flag with the new semantics. The obvious and common approach would be to widen the table entries. I'm not a big fan of this because it bloats the small-footprint systems. This is maybe why it hasn't been done already?

Another approach would be to keep the "C" locale table and macros, but if extended charsets are supported just convert everything to UNICODE and handle it there. Some functions, such as tolower, are already using this approach. We might be able to improve mbtowc to make this less painful, but regardless this will be a dog for performance. The benefit is centralization. I think this approach is a reasonable choice for isblank. I don't care for the "half hardcoded" variation of isblank; seems like an accident waiting to happen.

Both _N and _X are locale-invariant, making them good candidates for removal from the ctype table. If we wanted to recover ONE flag, I'd take _N rather than _X. In this case add _X to the digits and use _X in isprint, isgraph, and isalnum. It is possible to implement isdigit as a standard macro with single evaluation:

#define	isdigit(c) ((unsigned)((c)-'0')<=9)

Hard choices...

Mike

---
Mike Burgess
Avanex Corporation


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]