aboutsummaryrefslogtreecommitdiffhomepage
path: root/common.cpp
diff options
context:
space:
mode:
authorGravatar ridiculousfish <corydoras@ridiculousfish.com>2012-01-31 21:06:52 -0800
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2012-01-31 21:06:52 -0800
commitbb19fe703a2711ddad1b381498fea2d703b92d91 (patch)
treec2c3d5ada2474073925547ab672f87c744d0c691 /common.cpp
parenteef1e3e77e9ec1c80c7a388c2a5433bbc9910db3 (diff)
Fixup wsetlocale to use wcstring
Diffstat (limited to 'common.cpp')
-rw-r--r--common.cpp17
1 files changed, 4 insertions, 13 deletions
diff --git a/common.cpp b/common.cpp
index 72d66239..6564a7ac 100644
--- a/common.cpp
+++ b/common.cpp
@@ -573,12 +573,11 @@ wchar_t *quote_end( const wchar_t *pos )
}
-const wchar_t *wsetlocale(int category, const wchar_t *locale)
+wcstring wsetlocale(int category, const wchar_t *locale)
{
char *lang = locale?wcs2str( locale ):0;
char * res = setlocale(category,lang);
-
free( lang );
/*
@@ -588,17 +587,9 @@ const wchar_t *wsetlocale(int category, const wchar_t *locale)
ellipsis_char = (strstr( ctype, ".UTF")||strstr( ctype, ".utf") )?L'\x2026':L'$';
if( !res )
- return 0;
-
- if( !setlocale_buff )
- {
- setlocale_buff = sb_halloc( global_context);
- }
-
- sb_clear( setlocale_buff );
- sb_printf( setlocale_buff, L"%s", res );
-
- return (wchar_t *)setlocale_buff->buff;
+ return wcstring();
+ else
+ return format_string(L"%s", res);
}
bool contains_internal( const wchar_t *a, ... )