tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Per thread locales

New firefox uses a newer version of skia that uses a  helper class
"GrAutoLocaleSetter" to temporarily switch the locale to "C" while parsing
GL shaders.

IIUC Jörg strongly prefers to fix all locale sensitiv calls to use variants
explicitly passing the locale (which is most simple for "C").

However, this is not always trivial (when the code uses lots of deeply nested
library code) so patches are hard to verify and even harder to upstream.

I would argue that besides very special situations the usage sketched above
is the only valid reason to temporarily switch locales at runtime, and it may
make sense to add special case support for it.

A relatively simple & cheap hack would be a per-thread flag "override process
locale with C" and a uselocale() function that recognizes "C" and the
process locale and then sets/clears the flag accordingly, failing in all
other cases.



Home | Main Index | Thread Index | Old Index