[libcxx] r195044 - This patch implements snprintf_l function in a way similar to the other
Yaron Keren
yaron.keren at gmail.com
Mon Nov 18 13:12:14 PST 2013
Author: yrnkrn
Date: Mon Nov 18 15:12:14 2013
New Revision: 195044
URL: http://llvm.org/viewvc/llvm-project?rev=195044&view=rev
Log:
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.
Modified:
libcxx/trunk/include/support/win32/locale_win32.h
libcxx/trunk/src/support/win32/locale_win32.cpp
Modified: libcxx/trunk/include/support/win32/locale_win32.h
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/support/win32/locale_win32.h?rev=195044&r1=195043&r2=195044&view=diff
==============================================================================
--- libcxx/trunk/include/support/win32/locale_win32.h (original)
+++ libcxx/trunk/include/support/win32/locale_win32.h Mon Nov 18 15:12:14 2013
@@ -103,9 +103,9 @@ isupper_l(int c, _locale_t loc)
#define sscanf_l( __s, __l, __f, ...) _sscanf_l( __s, __f, __l, __VA_ARGS__ )
#define vsscanf_l( __s, __l, __f, ...) _sscanf_l( __s, __f, __l, __VA_ARGS__ )
#define sprintf_l( __s, __l, __f, ... ) _sprintf_l( __s, __f, __l, __VA_ARGS__ )
-#define snprintf_l( __s, __n, __l, __f, ... ) _snprintf_l( __s, __n, __f, __l, __VA_ARGS__ )
#define vsprintf_l( __s, __l, __f, ... ) _vsprintf_l( __s, __f, __l, __VA_ARGS__ )
#define vsnprintf_l( __s, __n, __l, __f, ... ) _vsnprintf_l( __s, __n, __f, __l, __VA_ARGS__ )
+int snprintf_l(char *ret, size_t n, locale_t loc, const char *format, ...);
int asprintf_l( char **ret, locale_t loc, const char *format, ... );
int vasprintf_l( char **ret, locale_t loc, const char *format, va_list ap );
Modified: libcxx/trunk/src/support/win32/locale_win32.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/support/win32/locale_win32.cpp?rev=195044&r1=195043&r2=195044&view=diff
==============================================================================
--- libcxx/trunk/src/support/win32/locale_win32.cpp (original)
+++ libcxx/trunk/src/support/win32/locale_win32.cpp Mon Nov 18 15:12:14 2013
@@ -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;
More information about the cfe-commits
mailing list