OSDN Git Service

make the default locale (& a variant) failure-free cases for newlocale
authorRich Felker <dalias@aerifal.cx>
Mon, 22 Oct 2018 04:22:33 +0000 (00:22 -0400)
committerRich Felker <dalias@aerifal.cx>
Mon, 22 Oct 2018 04:22:33 +0000 (00:22 -0400)
commit5af1f5942b2068d99182991dc212bdb3f5e9973d
treec804d4ca66f5ed7ef6a85f708937fe0e6e05aa98
parent74e704006a0004058fc38806a19c1552b1e2463d
make the default locale (& a variant) failure-free cases for newlocale

commit aeeac9ca5490d7d90fe061ab72da446c01ddf746 introduced fail-safe
invariants that creating a locale_t object for the C locale or C.UTF-8
locale will always succeed. extend the guarantee to also cover the
following:

- newlocale(LC_ALL_MASK, "", 0)
- newlocale(LC_ALL_MASK-LC_CTYPE_MASK, "C", 0)

provided that the LANG/LC_* environment variables have not been
changed by the program. these usages are idiomatic for getting the
default locale, and for getting a locale that behaves as the C locale
except for honoring the default locale's character encoding.
src/locale/newlocale.c