aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3/config/locale/gnu/c_locale.h
diff options
context:
space:
mode:
Diffstat (limited to 'libstdc++-v3/config/locale/gnu/c_locale.h')
-rw-r--r--libstdc++-v3/config/locale/gnu/c_locale.h23
1 files changed, 13 insertions, 10 deletions
diff --git a/libstdc++-v3/config/locale/gnu/c_locale.h b/libstdc++-v3/config/locale/gnu/c_locale.h
index 6bc4c39577e..069074eb9fe 100644
--- a/libstdc++-v3/config/locale/gnu/c_locale.h
+++ b/libstdc++-v3/config/locale/gnu/c_locale.h
@@ -38,6 +38,9 @@
#pragma GCC system_header
+#include <cstring> // get std::strlen
+#include <cstdlib> // get std::malloc
+#include <cstdio> // get std::snprintf or std::sprintf
#include <clocale>
#include <langinfo.h> // For codecvt
#include <iconv.h> // For codecvt using iconv, iconv_t
@@ -72,31 +75,31 @@ namespace std
#else
_Tv __v, const __c_locale&, int __prec = -1)
{
- char* __old = setlocale(LC_ALL, NULL);
- char* __sav = static_cast<char*>(malloc(strlen(__old) + 1));
+ char* __old = std::setlocale(LC_ALL, NULL);
+ char* __sav = static_cast<char*>(std::malloc(std::strlen(__old) + 1));
if (__sav)
- strcpy(__sav, __old);
- setlocale(LC_ALL, "C");
+ std::strcpy(__sav, __old);
+ std::setlocale(LC_ALL, "C");
#endif
int __ret;
#ifdef _GLIBCXX_USE_C99
if (__prec >= 0)
- __ret = snprintf(__out, __size, __fmt, __prec, __v);
+ __ret = std::snprintf(__out, __size, __fmt, __prec, __v);
else
- __ret = snprintf(__out, __size, __fmt, __v);
+ __ret = std::snprintf(__out, __size, __fmt, __v);
#else
if (__prec >= 0)
- __ret = sprintf(__out, __fmt, __prec, __v);
+ __ret = std::sprintf(__out, __fmt, __prec, __v);
else
- __ret = sprintf(__out, __fmt, __v);
+ __ret = std::sprintf(__out, __fmt, __v);
#endif
#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
__gnu_cxx::__uselocale(__old);
#else
- setlocale(LC_ALL, __sav);
- free(__sav);
+ std::setlocale(LC_ALL, __sav);
+ std::free(__sav);
#endif
return __ret;
}