Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
XXX why not failing tests before this?Create S_native_querylocale_i()…
… and use it This new function differs from the already existing plain querylocale_i() in that it returns in the platform's native format, instead of the internal=to-perl one. The internal one is used generally so that code doesn't have to cope with multiple possible formats. The format of the new locale in Perl_setlocale() is going to be in native format. We effectively translate it into our internal one at the input edge, and that is used thereafter. But until this commit, the translation back to native format at the output edge was incomplete. This mostly worked because native format differs from locale.c internal format in just two ways. One is the locale for LC_NUMERIC. perl keeps it generally in the C locale, except for brief intervals which higher level code specifies, when the real locale is swapped in. (Actually, this isn't quite true. If the real locale is indistinguishable from C as far as LC_NUMERIC goes, perl is happy to use it rather than C, so as to save swapping.) locale.c had the code in it to translate the internal format back to native, so it worked for this case. The other is LC_ALL when not all categories are set to the same locale. Windows and Linux use 'name=value;' pairs notation, while things derived from BSD (and others) use a positional notation in which only the values are given, and the system knows which category a given value is for from its position in the string. Perl worked fine for the name=value pairs notation, because that is the same as its internal one, so no translation got done, but until this commit, there were issues on positional platforms. This seldom got in the way since most people, if they set the locale at all, will just set it to some single 'foo'. What this commit effectively does is change Perl_setlocale() to return the value in the native format which the libc functions are expecting. This differs from what it used to return only on platforms which use the positional notation and only for LC_ALL when not all categories are set to the same locale. The new function subsumes much of the work previously done in Perl_setlocale(), and it is able to simplify some of that work.
- Loading branch information
1 parent
0c755b2
commit 30ca6a4
Showing
4 changed files
with
75 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.