diff options
author | Yaron Keren <yaron.keren@gmail.com> | 2013-11-18 21:12:14 +0000 |
---|---|---|
committer | Yaron Keren <yaron.keren@gmail.com> | 2013-11-18 21:12:14 +0000 |
commit | fbeb63c0d15874bd71b6e2201f69a06e1336335e (patch) | |
tree | 7f888aeec75a471461ecd17776cb1cd57da14517 /libcxx/src | |
parent | ff924b08dd3db5f86dc9ad048159d2babc4aa67f (diff) | |
download | bcm5719-llvm-fbeb63c0d15874bd71b6e2201f69a06e1336335e.tar.gz bcm5719-llvm-fbeb63c0d15874bd71b6e2201f69a06e1336335e.zip |
This patch implements snprintf_l function in a way similar to the other
functions in src/support/win32/locale_win32.cpp and locale_win32.h,
calling upon vsnprintf for which there is a MingW correct alternative.
Note! __USE_MINGW_ANSI_STDIO is not modified in this patch. In order to
use the __mingw version it must be defined before including the MingW
headers.
llvm-svn: 195044
Diffstat (limited to 'libcxx/src')
-rw-r--r-- | libcxx/src/support/win32/locale_win32.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/libcxx/src/support/win32/locale_win32.cpp b/libcxx/src/support/win32/locale_win32.cpp index 1729d84a366..5a43743470d 100644 --- a/libcxx/src/support/win32/locale_win32.cpp +++ b/libcxx/src/support/win32/locale_win32.cpp @@ -80,6 +80,16 @@ int wctob_l( wint_t c, locale_t loc ) return wctob( c ); } +int snprintf_l(char *ret, size_t n, locale_t loc, const char *format, ...) +{ + __locale_raii __current( uselocale(loc), uselocale ); + va_list ap; + va_start( ap, format ); + int result = vsnprintf( ret, n, format, ap ); + va_end(ap); + return result; +} + int asprintf_l( char **ret, locale_t loc, const char *format, ... ) { va_list ap; |