diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2010-02-11 10:04:51 +0000 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2010-02-11 10:04:51 +0000 |
commit | 87c0903113e795eec917464e3a0e70d6d9a3037f (patch) | |
tree | 290fcf94aba3c5f3304ef6a4f371910a65e6e136 | |
parent | 374a555fda45aacab29bfc056cad0eb677b63a1f (diff) | |
download | cygnal-87c0903113e795eec917464e3a0e70d6d9a3037f.tar.gz cygnal-87c0903113e795eec917464e3a0e70d6d9a3037f.tar.bz2 cygnal-87c0903113e795eec917464e3a0e70d6d9a3037f.zip |
* 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.
-rw-r--r-- | winsup/cygwin/ChangeLog | 7 | ||||
-rw-r--r-- | winsup/cygwin/nlsfuncs.cc | 10 |
2 files changed, 14 insertions, 3 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 3221fd1e2..39e72d4a7 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,10 @@ +2010-02-11 Andy Koppe <andy.koppe@gmail.com> + + * 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. + 2010-02-10 Corinna Vinschen <corinna@vinschen.de> * nlsfuncs.cc (__set_charset_from_locale): Allow "@euro" modifier only 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 (); } |