From 0b385f145ce6144b5812bd89fa8f73369bcbe57f Mon Sep 17 00:00:00 2001 From: Kurtis Rader Date: Fri, 3 Jun 2016 19:05:13 -0700 Subject: simplify, and fix, setting the current locale Fix test setup bogosities. Specifically, they weren't hermetic with respect to locale env vars. Rewrite the handling of locale vars to simplify the code and make it more like the pattern most programs employ. Fixes #3110 --- src/common.cpp | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'src/common.cpp') diff --git a/src/common.cpp b/src/common.cpp index 1ad51482..d0fdccb6 100644 --- a/src/common.cpp +++ b/src/common.cpp @@ -6,7 +6,6 @@ #include #include #include -#include #include #include #include @@ -470,19 +469,12 @@ wchar_t *quote_end(const wchar_t *pos) { return 0; } -wcstring wsetlocale(int category, const wchar_t *locale) { - char *lang = locale ? wcs2str(locale) : NULL; - char *res = setlocale(category, lang); - free(lang); - +void fish_setlocale() { // Use ellipsis if on known unicode system, otherwise use $. ellipsis_char = (wcwidth(L'\x2026') > 0) ? L'\x2026' : L'$'; // U+23CE is the "return" character omitted_newline_char = (wcwidth(L'\x23CE') > 0) ? L'\x23CE' : L'~'; - - if (!res) return wcstring(); - return format_string(L"%s", res); } bool contains_internal(const wchar_t *a, int vararg_handle, ...) { -- cgit v1.2.3