OSDN Git Service

simplify newlocale and allow failure for explicit locale names
authorRich Felker <dalias@aerifal.cx>
Sun, 21 Oct 2018 05:09:20 +0000 (01:09 -0400)
committerRich Felker <dalias@aerifal.cx>
Mon, 22 Oct 2018 04:20:10 +0000 (00:20 -0400)
commit74e704006a0004058fc38806a19c1552b1e2463d
tree9cdfabba89d161a991ed93e0b9d368a59215c4b2
parent6753fb68b84cd7155d8b9a3a3bc3eff1ab6a8030
simplify newlocale and allow failure for explicit locale names

unify the code paths for allocated and non-allocated locale objects,
always using a tmp object. this is necessary to avoid clobbering the
base locale object too soon if we allow for the possibility that
looking up an explicitly requested locale name may fail, and makes the
code simpler and cleaner anyway.

eliminate the complex and fragile logic for checking whether one of
the non-allocated locale objects can be used for the result, and
instead just memcmp against each of them.
src/locale/newlocale.c