summaryrefslogtreecommitdiffstats
path: root/libstdc++-v3/config/locale/gnu/time_members.h
diff options
context:
space:
mode:
Diffstat (limited to 'libstdc++-v3/config/locale/gnu/time_members.h')
-rw-r--r--libstdc++-v3/config/locale/gnu/time_members.h18
1 files changed, 12 insertions, 6 deletions
diff --git a/libstdc++-v3/config/locale/gnu/time_members.h b/libstdc++-v3/config/locale/gnu/time_members.h
index 7f97bcbbd7b..3e5e0c3ed20 100644
--- a/libstdc++-v3/config/locale/gnu/time_members.h
+++ b/libstdc++-v3/config/locale/gnu/time_members.h
@@ -59,17 +59,23 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
size_t __refs)
: facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL),
_M_name_timepunct(NULL)
- {
- const size_t __len = __builtin_strlen(__s) + 1;
- char* __tmp = new char[__len];
- __builtin_memcpy(__tmp, __s, __len);
- _M_name_timepunct = __tmp;
+ {
+ if (__builtin_strcmp(__s, _S_get_c_name()) != 0)
+ {
+ const size_t __len = __builtin_strlen(__s) + 1;
+ char* __tmp = new char[__len];
+ __builtin_memcpy(__tmp, __s, __len);
+ _M_name_timepunct = __tmp;
+ }
+ else
+ _M_name_timepunct = _S_get_c_name();
try
{ _M_initialize_timepunct(__cloc); }
catch(...)
{
- delete [] _M_name_timepunct;
+ if (_M_name_timepunct != _S_get_c_name())
+ delete [] _M_name_timepunct;
__throw_exception_again;
}
}
OpenPOWER on IntegriCloud