This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [v3] Include <cstdio>, qualify with std:: config/locale/*/c_locale.h
- From: Paolo Carlini <pcarlini at unitus dot it>
- To: Paolo Carlini <pcarlini at unitus dot it>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Mon, 14 Jul 2003 22:17:26 +0200
- Subject: Re: [v3] Include <cstdio>, qualify with std:: config/locale/*/c_locale.h
- References: <3F130969.2050109@unitus.it>
Paolo Carlini wrote:
Hi,
tested x86-linux.
... and some more.
Paolo.
/////////
2003-07-14 Paolo Carlini <pcarlini@unitus.it>
* include/bits/stl_tempbuf.h: Qualify free with std::.
* src/locale.cc: Include <cstdlib>, qualify getenv.
diff -urN libstdc++-v3-orig/include/bits/stl_tempbuf.h libstdc++-v3/include/bits/stl_tempbuf.h
--- libstdc++-v3-orig/include/bits/stl_tempbuf.h 2003-07-05 06:05:35.000000000 +0200
+++ libstdc++-v3/include/bits/stl_tempbuf.h 2003-07-14 21:52:47.000000000 +0200
@@ -125,7 +125,7 @@
}
catch(...)
{
- free(_M_buffer);
+ std::free(_M_buffer);
_M_buffer = 0;
_M_len = 0;
__throw_exception_again;
@@ -134,7 +134,7 @@
~_Temporary_buffer() {
std::_Destroy(_M_buffer, _M_buffer + _M_len);
- free(_M_buffer);
+ std::free(_M_buffer);
}
private:
diff -urN libstdc++-v3-orig/src/locale.cc libstdc++-v3/src/locale.cc
--- libstdc++-v3-orig/src/locale.cc 2003-07-10 08:21:12.000000000 +0200
+++ libstdc++-v3/src/locale.cc 2003-07-14 21:59:32.000000000 +0200
@@ -28,6 +28,7 @@
#include <clocale>
#include <cstring>
+#include <cstdlib> // For getenv, free.
#include <cctype>
#include <cwctype> // For towupper, etc.
#include <locale>
@@ -183,7 +184,7 @@
else
{
// Get it from the environment.
- char* __env = getenv("LC_ALL");
+ char* __env = std::getenv("LC_ALL");
// If LC_ALL is set we are done.
if (__env && std::strcmp(__env, "") != 0)
{
@@ -197,7 +198,7 @@
{
char* __res;
// LANG may set a default different from "C".
- char* __env = getenv("LANG");
+ char* __env = std::getenv("LANG");
if (!__env || std::strcmp(__env, "") == 0
|| std::strcmp(__env, "C") == 0
|| std::strcmp(__env, "POSIX") == 0)
@@ -211,7 +212,7 @@
if (std::strcmp(__res, "C") == 0)
for (; __i < _S_categories_size; ++__i)
{
- __env = getenv(_S_categories[__i]);
+ __env = std::getenv(_S_categories[__i]);
if (__env && std::strcmp(__env, "") != 0
&& std::strcmp(__env, "C") != 0
&& std::strcmp(__env, "POSIX") != 0)
@@ -220,7 +221,7 @@
else
for (; __i < _S_categories_size; ++__i)
{
- __env = getenv(_S_categories[__i]);
+ __env = std::getenv(_S_categories[__i]);
if (__env && std::strcmp(__env, "") != 0
&& std::strcmp(__env, __res) != 0)
break;
@@ -245,7 +246,7 @@
__i++;
for (; __i < _S_categories_size; ++__i)
{
- __env = getenv(_S_categories[__i]);
+ __env = std::getenv(_S_categories[__i]);
if (!__env || std::strcmp(__env, "") == 0)
{
__str += _S_categories[__i];
@@ -276,7 +277,7 @@
(_M_impl = _S_classic)->_M_add_reference();
else
_M_impl = new _Impl(__res, 1);
- free(__res);
+ std::free(__res);
}
}
}