mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-26 04:43:10 +00:00
parent
d5ca88d42d
commit
4f397e86d7
1 changed files with 4 additions and 1 deletions
|
@ -191,7 +191,9 @@ static bool var_is_locale(const wcstring &key) {
|
|||
/// Properly sets all locale information.
|
||||
static void handle_locale(const wchar_t *env_var_name) {
|
||||
debug(2, L"handle_locale() called in response to '%ls' changing", env_var_name);
|
||||
const char *old_msg_locale = setlocale(LC_MESSAGES, NULL);
|
||||
// We have to make a copy because the subsequent setlocale() call to change the locale will
|
||||
// invalidate the pointer from the this setlocale() call.
|
||||
char *old_msg_locale = strdup(setlocale(LC_MESSAGES, NULL));
|
||||
const env_var_t val = env_get_string(env_var_name, ENV_EXPORT);
|
||||
const std::string &value = wcs2string(val);
|
||||
const std::string &name = wcs2string(env_var_name);
|
||||
|
@ -216,6 +218,7 @@ static void handle_locale(const wchar_t *env_var_name) {
|
|||
_nl_msg_cat_cntr++;
|
||||
}
|
||||
#endif
|
||||
free(old_msg_locale);
|
||||
}
|
||||
|
||||
/// Check if the specified variable is a locale variable.
|
||||
|
|
Loading…
Reference in a new issue