Migrate invalidate_numeric_locale into fish_setlocale

Centralizes where locale information is recomputed.
This commit is contained in:
Peter Ammon
2025-08-10 15:37:26 -07:00
parent 623c14aed0
commit 4b12fb2887
2 changed files with 5 additions and 2 deletions

View File

@@ -10,6 +10,7 @@
use crate::global_safety::RelaxedAtomicBool;
use crate::key;
use crate::libc::MB_CUR_MAX;
use crate::locale::invalidate_numeric_locale;
use crate::parse_util::parse_util_escape_string_with_quote;
use crate::terminal::Output;
use crate::termsize::Termsize;
@@ -1278,6 +1279,9 @@ pub fn should_suppress_stderr_for_tests() -> bool {
/// This function should be called after calling `setlocale()` to perform fish specific locale
/// initialization.
pub fn fish_setlocale() {
// Invalidate the cached numeric locale.
invalidate_numeric_locale();
// Helper to make a static reference to a static &'wstr, from a string literal.
// This is necessary to store them in global atomics, as these can't handle fat pointers.
macro_rules! LL {

View File

@@ -575,8 +575,7 @@ fn init_locale(vars: &EnvStack) {
// should never fail, the C locale should always be defined
assert_ne!(loc_ptr, ptr::null_mut());
// See that we regenerate our special locale for numbers
crate::locale::invalidate_numeric_locale();
// Update cached locale information.
crate::common::fish_setlocale();
FLOG!(
env_locale,