[PATCH] setlocale changes

Ulrich Drepper drepper@redhat.com
Tue Jan 2 14:47:00 GMT 2001


Jakub Jelinek <jakub@redhat.com> writes:

> I'm not entirely sure I understand.
> Do you say that
> char *p = setlocale(LC_CTYPE, "");
> setlocale(LC_ALL, "");
> setlocale(LC_CTYPE, p);
> 
> should work or did you just mean if the middle setlocale is not present?

The above cannot be expected to work.  You have to dup the string.

> Those 3 lines don't work in current glibc, but could be made to work much
> more easily (it is wasteful to allocate the same string again and free the
> other one soon afterwards):

Not needed.  Fix the application.

-- 
---------------.                          ,-.   1325 Chesapeake Terrace
Ulrich Drepper  \    ,-------------------'   \  Sunnyvale, CA 94089 USA
Red Hat          `--' drepper at redhat.com   `------------------------


More information about the Libc-hacker mailing list