aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3/config/locale/gnu/c_locale.h
diff options
context:
space:
mode:
authorStephen M. Webb <stephen.webb@bregmasoft.com>2004-01-30 03:43:00 +0000
committerBenjamin Kosnik <bkoz@gcc.gnu.org>2004-01-30 03:43:00 +0000
commit917a9fd4d5ce9ee5c906abb10812a316b77fc31c (patch)
treefcf9db0ae11adc880d72ac1fdbb94ef6a98414ca /libstdc++-v3/config/locale/gnu/c_locale.h
parentae8f0c17739a44cfeb118280fc59626108b1eb5f (diff)
downloadgcc-917a9fd4d5ce9ee5c906abb10812a316b77fc31c.zip
gcc-917a9fd4d5ce9ee5c906abb10812a316b77fc31c.tar.gz
gcc-917a9fd4d5ce9ee5c906abb10812a316b77fc31c.tar.bz2
c_locale.h: Change ::malloc() to new char[].
2004-01-29 Stephen M. Webb <stephen.webb@bregmasoft.com> * config/local/generic/c_locale.h: Change ::malloc() to new char[]. * config/local/gnu/c_locale.h: Change ::malloc() to new char[]. * include/bits/stl_tempbuf.h: Convert _Temporary_buffer to use std::get_temporary_buffer() instead of duplicating its code. Update to C++STYLE conventions. * include/std/std_memory.h (get_temporary_buffer): Use ::operator new() instead of std::malloc(). (return_temporary_buffer): Use ::operator delete() instead of std::free(). From-SVN: r76922
Diffstat (limited to 'libstdc++-v3/config/locale/gnu/c_locale.h')
-rw-r--r--libstdc++-v3/config/locale/gnu/c_locale.h10
1 files changed, 4 insertions, 6 deletions
diff --git a/libstdc++-v3/config/locale/gnu/c_locale.h b/libstdc++-v3/config/locale/gnu/c_locale.h
index 069074e..fe899cf 100644
--- a/libstdc++-v3/config/locale/gnu/c_locale.h
+++ b/libstdc++-v3/config/locale/gnu/c_locale.h
@@ -1,6 +1,6 @@
// Wrapper for underlying C-language localization -*- C++ -*-
-// Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -39,7 +39,6 @@
#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
@@ -76,9 +75,8 @@ namespace std
_Tv __v, const __c_locale&, int __prec = -1)
{
char* __old = std::setlocale(LC_ALL, NULL);
- char* __sav = static_cast<char*>(std::malloc(std::strlen(__old) + 1));
- if (__sav)
- std::strcpy(__sav, __old);
+ char* __sav = new char[std::strlen(__old) + 1];
+ std::strcpy(__sav, __old);
std::setlocale(LC_ALL, "C");
#endif
@@ -99,7 +97,7 @@ namespace std
__gnu_cxx::__uselocale(__old);
#else
std::setlocale(LC_ALL, __sav);
- std::free(__sav);
+ delete [] __sav;
#endif
return __ret;
}