wutil: remove unused locale handling code that has been ported already

This commit is contained in:
Johannes Altmanninger 2023-04-09 12:12:13 +02:00
parent 77ae80f842
commit 8ae1ba3432
3 changed files with 3 additions and 26 deletions

View file

@ -11,6 +11,8 @@
#include <cstring>
#include <cwchar>
#include "ffi_init.rs.h"
#if HAVE_CURSES_H
#include <curses.h> // IWYU pragma: keep
#elif HAVE_NCURSES_H
@ -656,7 +658,7 @@ static void init_locale(const environment_t &vars) {
setlocale(LC_NUMERIC, "C");
// See that we regenerate our special locale for numbers.
fish_invalidate_numeric_locale();
rust_invalidate_numeric_locale();
fish_setlocale();
FLOGF(env_locale, L"init_locale() setlocale(): '%s'", locale);

View file

@ -33,7 +33,6 @@
#include "common.h"
#include "fallback.h" // IWYU pragma: keep
#include "fds.h"
#include "ffi_init.rs.h"
#include "flog.h"
#include "wcstringutil.h"
@ -627,24 +626,6 @@ int fish_wcswidth(const wchar_t *str) { return fish_wcswidth(str, std::wcslen(st
/// See fallback.h for the normal definitions.
int fish_wcswidth(const wcstring &str) { return fish_wcswidth(str.c_str(), str.size()); }
static bool fish_numeric_locale_is_valid = false;
void fish_invalidate_numeric_locale() {
fish_numeric_locale_is_valid = false;
rust_invalidate_numeric_locale();
}
locale_t fish_numeric_locale() {
// The current locale, except LC_NUMERIC isn't forced to C.
static locale_t loc = nullptr;
if (!fish_numeric_locale_is_valid) {
if (loc != nullptr) freelocale(loc);
auto cur = duplocale(LC_GLOBAL_LOCALE);
loc = newlocale(LC_NUMERIC_MASK, "", cur);
fish_numeric_locale_is_valid = true;
}
return loc;
}
/// Like fish_wcstol(), but fails on a value outside the range of an int.
///
/// This is needed because BSD and GNU implementations differ in several ways that make it really

View file

@ -136,12 +136,6 @@ int fish_iswgraph(wint_t wc);
int fish_wcswidth(const wchar_t *str);
int fish_wcswidth(const wcstring &str);
// returns an immortal locale_t corresponding to the C locale.
locale_t fish_c_locale();
void fish_invalidate_numeric_locale();
locale_t fish_numeric_locale();
int fish_wcstoi(const wchar_t *str, const wchar_t **endptr = nullptr, int base = 10);
long fish_wcstol(const wchar_t *str, const wchar_t **endptr = nullptr, int base = 10);
long long fish_wcstoll(const wchar_t *str, const wchar_t **endptr = nullptr, int base = 10);