Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2010-02-11 13:04:51 +0300
committerCorinna Vinschen <corinna@vinschen.de>2010-02-11 13:04:51 +0300
commit87c0903113e795eec917464e3a0e70d6d9a3037f (patch)
tree290fcf94aba3c5f3304ef6a4f371910a65e6e136 /winsup/cygwin/nlsfuncs.cc
parent374a555fda45aacab29bfc056cad0eb677b63a1f (diff)
* nlsfuncs.cc (initial_setlocale): Move check whether charset has
changed from here... (internal_setlocale): ...to here, to avoid unnecessary work when invoked via CW_INT_SETLOCALE.
Diffstat (limited to 'winsup/cygwin/nlsfuncs.cc')
-rw-r--r--winsup/cygwin/nlsfuncs.cc10
1 files changed, 7 insertions, 3 deletions
diff --git a/winsup/cygwin/nlsfuncs.cc b/winsup/cygwin/nlsfuncs.cc
index 5fa767b84..8444768b6 100644
--- a/winsup/cygwin/nlsfuncs.cc
+++ b/winsup/cygwin/nlsfuncs.cc
@@ -1129,12 +1129,17 @@ internal_setlocale ()
/* FIXME: It could be necessary to convert the entire environment,
not just PATH. */
tmp_pathbuf tp;
- char *path = getenv ("PATH");
+ char *path;
wchar_t *w_path = NULL, *w_cwd;
+ /* Don't do anything if the charset hasn't actually changed. */
+ if (strcmp (cygheap->locale.charset, __locale_charset ()) == 0)
+ return;
+
debug_printf ("Cygwin charset changed from %s to %s",
cygheap->locale.charset, __locale_charset ());
/* Fetch PATH and CWD and convert to wchar_t in previous charset. */
+ path = getenv ("PATH");
if (path && *path) /* $PATH can be potentially unset. */
{
w_path = tp.w_get ();
@@ -1175,8 +1180,7 @@ void
initial_setlocale ()
{
char *ret = _setlocale_r (_REENT, LC_CTYPE, "");
- if (ret && check_codepage (ret)
- && strcmp (cygheap->locale.charset, __locale_charset ()) != 0)
+ if (ret && check_codepage (ret))
internal_setlocale ();
}