[PATCH/RFA] Revamp wctomb/mbtowc conversion, add more charset support

Corinna Vinschen vinschen@redhat.com
Tue Mar 24 23:21:00 GMT 2009

On Mar 24 05:53, Eric Blake wrote:
> Hash: SHA1
> According to Corinna Vinschen on 3/24/2009 4:44 AM:
> > The simplest method is to have the 32 or 33 ctype tables and just change
> > __ctype_ptr to point to the right one.  This has an advantage, speed,
> > and a disadvantage, size.  This method also doesn't work for Cygwin.
> But another advantage - when we finally get around to implementing
> is_alnum_l and friends, we need multiple tables to be accessible at once,
> and dispatch to the correct table according to the locale_t argument.
> This seems a lot easier if the tables are distinct than if we are
> modifying the single table every time we swap locales.

The problem is backward compatibility.  Older applications would not
profit at all from the character class tables if we switch to newlib's
new ctype method and just keep the old _ctype_b array lying around.

I agree that it would be nice if we changed Cygwin's implementation to
use __ctype_ptr as well.  It's much better than the current hardcoded

For now I'll check in my change to Cygwin's ctype nevertheless.  It's
much better than what we have now, ignoring every non-ASCII char.
Fortunately it doesn't collide with a new implementations if we decide
to get around to it.


Corinna Vinschen
Cygwin Project Co-Leader
Red Hat

More information about the Newlib mailing list