aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/common.cpp
diff options
context:
space:
mode:
authorGravatar Kurtis Rader <krader@skepticism.us>2016-06-03 19:05:13 -0700
committerGravatar Kurtis Rader <krader@skepticism.us>2016-06-05 15:49:34 -0700
commit0b385f145ce6144b5812bd89fa8f73369bcbe57f (patch)
tree3d3b059af2e9a7efb6fe38e33ee1782b23e6167e /src/common.cpp
parent32a585a52b20687a1a16c45142da2261d28b7a27 (diff)
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
Diffstat (limited to 'src/common.cpp')
-rw-r--r--src/common.cpp10
1 files changed, 1 insertions, 9 deletions
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 <dlfcn.h>
#include <errno.h>
#include <limits.h>
-#include <locale.h>
#include <math.h>
#include <signal.h>
#include <stdarg.h>
@@ -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, ...) {