diff options
author | paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-05-11 18:58:08 +0000 |
---|---|---|
committer | paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-05-11 18:58:08 +0000 |
commit | c75998259b237abe9fce03ad23bf3ee0197b363a (patch) | |
tree | e42cbc75bd6a7bf2b85115f2a9d27c274708b47f /libstdc++-v3/config/locale/gnu/messages_members.cc | |
parent | e6fa0ea601965ab7a19c55ca870bdb2cdebaf324 (diff) | |
download | gcc-c75998259b237abe9fce03ad23bf3ee0197b363a.tar.gz |
2007-05-11 Paolo Carlini <pcarlini@suse.de>
* include/ext/pod_char_traits.h (char_traits<>::move):
Use __builtin_memmove.
* include/bits/locale_classes.h (locale::_Impl::_M_check_same_name,
collate_byname(const char*, size_t)): Use __builtin_strcmp.
* include/bits/locale_facets.h: Use __builtin_mem* and
__builtin_str* everywhere.
* include/bits/codecvt.h (codecvt_byname(const char*, size_t)):
Use __builtin_strcmp.
* include/bits/char_traits.h: Use __builtin_mem* everywhere.
* include/bits/fstream.tcc (basic_filebuf<>::underflow, imbue):
Use __builtin_memcpy and __builtin_memmove.
* include/bits/locale_facets_nonio.h (moneypunct_byname(const char*,
size_t __refs)): Use __builtin_strcmp.
* include/std/bitset (bitset<>::_M_do_reset): Use __builtin_memset.
* config/locale/gnu/c_locale.h: Use __builtin_strlen, __builtin_strcmp,
and __builtin_memcpy.
* config/locale/gnu/messages_members.h: Likewise.
* config/locale/gnu/time_members.h: Likewise.
* config/locale/generic/c_locale.h: Likewise.
* config/locale/generic/messages_members.h: Likewise.
* config/locale/generic/time_members.h: Likewise.
* config/os/gnu-linux/ctype_noninline.h: Likewise, avoid strdup.
* config/os/tpf/ctype_noninline.h: Likewise.
* config/locale/generic/codecvt_members.cc: Include <cstring>.
* config/locale/generic/ctype_members.cc: Likewise.
* config/locale/generic/collate_members.cc: Likewise.
* config/locale/gnu/c++locale_internal.h: Likewise.
* config/locale/darwin/ctype_members.cc: Likewise.
* src/ctype.cc: Likewise.
* testsuite/19_diagnostics/logic_error/what-1.cc: Likewise.
* testsuite/19_diagnostics/logic_error/what-2.cc: Likewise.
* testsuite/19_diagnostics/runtime_error/what-1.cc: Likewise.
* testsuite/19_diagnostics/runtime_error/what-2.cc: Likewise.
* testsuite/19_diagnostics/runtime_error/what-3.cc: Likewise.
* config/locale/gnu/messages_members.cc: Avoid strdup.
* config/locale/gnu/monetary_members.cc: Likewise.
* config/locale/gnu/time_members.cc: Likewise.
* config/locale/gnu/time_members.cc: Likewise.
* config/locale/generic/c_locale.cc: Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@124623 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/config/locale/gnu/messages_members.cc')
-rw-r--r-- | libstdc++-v3/config/locale/gnu/messages_members.cc | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/libstdc++-v3/config/locale/gnu/messages_members.cc b/libstdc++-v3/config/locale/gnu/messages_members.cc index f206e44a636..cbecc56225b 100644 --- a/libstdc++-v3/config/locale/gnu/messages_members.cc +++ b/libstdc++-v3/config/locale/gnu/messages_members.cc @@ -49,11 +49,14 @@ _GLIBCXX_BEGIN_NAMESPACE(std) __uselocale(__old); return string(__msg); #else - char* __old = strdup(setlocale(LC_ALL, NULL)); + char* __old = setlocale(LC_ALL, NULL); + const size_t __len = strlen(__old) + 1; + char* __sav = new char[__len]; + memcpy(__sav, __old, __len); setlocale(LC_ALL, _M_name_messages); const char* __msg = gettext(__dfault.c_str()); - setlocale(LC_ALL, __old); - free(__old); + setlocale(LC_ALL, __sav); + delete [] __sav; return string(__msg); #endif } @@ -69,11 +72,14 @@ _GLIBCXX_BEGIN_NAMESPACE(std) __uselocale(__old); return _M_convert_from_char(__msg); # else - char* __old = strdup(setlocale(LC_ALL, NULL)); + char* __old = setlocale(LC_ALL, NULL); + const size_t __len = strlen(__old) + 1; + char* __sav = new char[__len]; + memcpy(__sav, __old, __len); setlocale(LC_ALL, _M_name_messages); char* __msg = gettext(_M_convert_to_char(__dfault)); - setlocale(LC_ALL, __old); - free(__old); + setlocale(LC_ALL, __sav); + delete [] __sav; return _M_convert_from_char(__msg); # endif } |