summaryrefslogtreecommitdiff
path: root/src/locale/locale_map.c
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2015-06-16 05:35:31 +0000
committerRich Felker <dalias@aerifal.cx>2015-06-16 06:10:29 +0000
commit16f18d036d9a7bf590ee6eb86785c0a9658220b6 (patch)
treedeb18b50c750e47dce2e0de0061f6de93cb11957 /src/locale/locale_map.c
parent1507ebf837334e9e07cfab1ca1c2e88449069a80 (diff)
downloadmusl-16f18d036d9a7bf590ee6eb86785c0a9658220b6.tar.gz
byte-based C locale, phase 2: stdio and iconv (multibyte callers)
this patch adjusts libc components which use the multibyte functions internally, and which depend on them operating in a particular encoding, to make the appropriate locale changes before calling them and restore the calling thread's locale afterwards. activating the byte-based C locale without these changes would cause regressions in stdio and iconv. in the case of iconv, the current implementation was simply using the multibyte functions as UTF-8 conversions. setting a multibyte UTF-8 locale for the duration of the iconv operation allows the code to continue working. in the case of stdio, POSIX requires that FILE streams have an encoding rule bound at the time of setting wide orientation. as long as all locales, including the C locale, used the same encoding, treating high bytes as UTF-8, there was no need to store an encoding rule as part of the stream's state. a new locale field in the FILE structure points to the locale that should be made active during fgetwc/fputwc/ungetwc on the stream. it cannot point to the locale active at the time the stream becomes oriented, because this locale could be mutable (the global locale) or could be destroyed (locale_t objects produced by newlocale) before the stream is closed. instead, a pointer to the static C or C.UTF-8 locale object added in commit commit aeeac9ca5490d7d90fe061ab72da446c01ddf746 is used. this is valid since categories other than LC_CTYPE will not affect these functions.
Diffstat (limited to 'src/locale/locale_map.c')
0 files changed, 0 insertions, 0 deletions