Wow, tested. Thx for improvements. Learnt a lots from recent patches related to locale. Sincerely thank you, rich :) xhe 2017-03-18 22:39 GMT+08:00 Rich Felker : > On Sat, Mar 18, 2017 at 09:48:41PM +0800, He X wrote: > > oops, i missed UNLOCK(lock). > > > > [...] > > >> > > >> I think the results of this patch can be achieved much more simply. > > >> Just compare lm pointers (rather than string contents) for equality at > > >> each iteration in the current loop, counting how many were equal to > > >> libc.global_locale.cat[0]. If that number equals LC_ALL, return > > >> libc.global_locale.cat[0]->name (or "C" if the lm is null) rather > than > > >> buf. > > >> > > >> Rich > > >> > > > > > > > > By simpler I meant something like the attached. > > Rich >