OSDN Git Service

2003-10-02 Benjamin Kosnik <bkoz@redhat.com>
authorbkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 2 Oct 2003 23:06:13 +0000 (23:06 +0000)
committerbkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 2 Oct 2003 23:06:13 +0000 (23:06 +0000)
* include/bits/locale_classes.h (locale::facet::_S_get_c_name): Add.
* src/locale.cc: Define.
* src/localename.cc: Use it.
* config/locale/generic/time_members.h: Same.
* config/locale/gnu/messages_members.h: Same.
* config/locale/gnu/time_members.h: Same.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@72050 138bc75d-0d04-0410-961f-82ee72b054a4

libstdc++-v3/ChangeLog
libstdc++-v3/config/locale/generic/time_members.h
libstdc++-v3/config/locale/gnu/messages_members.h
libstdc++-v3/config/locale/gnu/time_members.h
libstdc++-v3/include/bits/locale_classes.h
libstdc++-v3/src/locale.cc
libstdc++-v3/src/localename.cc

index 2cc15ac..8dd67c2 100644 (file)
@@ -1,3 +1,12 @@
+2003-10-02  Benjamin Kosnik  <bkoz@redhat.com>
+
+       * include/bits/locale_classes.h (locale::facet::_S_get_c_name): Add.
+       * src/locale.cc: Define.
+       * src/localename.cc: Use it.
+       * config/locale/generic/time_members.h: Same.
+       * config/locale/gnu/messages_members.h: Same.
+       * config/locale/gnu/time_members.h: Same.
+
 2003-10-02  Paolo Carlini  <pcarlini@unitus.it>
 
        PR libstdc++/12232
index 2da37eb..9801300 100644 (file)
@@ -38,7 +38,7 @@
     __timepunct<_CharT>::__timepunct(size_t __refs) 
     : facet(__refs), _M_data(NULL)
     { 
-      _M_name_timepunct = _S_c_name;
+      _M_name_timepunct = _S_get_c_name();
       _M_initialize_timepunct(); 
     }
 
@@ -46,7 +46,7 @@
     __timepunct<_CharT>::__timepunct(__cache_type* __cache, size_t __refs) 
     : facet(__refs), _M_data(__cache)
     { 
-      _M_name_timepunct = _S_c_name;
+      _M_name_timepunct = _S_get_c_name();
       _M_initialize_timepunct(); 
     }
 
@@ -64,7 +64,7 @@
   template<typename _CharT>
     __timepunct<_CharT>::~__timepunct()
     { 
-      if (_S_c_name != _M_name_timepunct)
+      if (_M_name_timepunct != _S_get_c_name())
        delete [] _M_name_timepunct;
       delete _M_data;
       _S_destroy_c_locale(_M_c_locale_timepunct); 
index fc2bb2e..9bb8e50 100644 (file)
@@ -39,7 +39,7 @@
      : facet(__refs)
      {  
 #if !(__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2))
-       _M_name_messages = _S_c_name;
+       _M_name_messages = _S_get_c_name();
 #endif
        _M_c_locale_messages = _S_get_c_locale(); 
      }
@@ -72,7 +72,7 @@
     messages<_CharT>::~messages()
     { 
 #if !(__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2))
-      if (_S_c_name != _M_name_messages)
+      if (_M_name_messages != _S_get_c_name())
        delete [] _M_name_messages;
 #endif
       _S_destroy_c_locale(_M_c_locale_messages); 
      : messages<_CharT>(__refs) 
      { 
 #if !(__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2))
-       if (this->_S_c_name != this->_M_name_messages)
+       if (this->_M_name_messages != locale::facet::_S_get_c_name())
         delete [] this->_M_name_messages;
        char* __tmp = new char[std::strlen(__s) + 1];
        std::strcpy(__tmp, __s);
index 3129cd1..142ed2b 100644 (file)
@@ -39,7 +39,7 @@
     : facet(__refs), _M_data(NULL)
     { 
 #if !(__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2))
-      _M_name_timepunct = _S_c_name;
+      _M_name_timepunct = _S_get_c_name();
 #endif
       _M_initialize_timepunct(); 
     }
@@ -49,7 +49,7 @@
     : facet(__refs), _M_data(__cache)
     { 
 #if !(__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2))
-      _M_name_timepunct = _S_c_name;
+      _M_name_timepunct = _S_get_c_name();
 #endif
       _M_initialize_timepunct(); 
     }
@@ -72,7 +72,7 @@
     __timepunct<_CharT>::~__timepunct()
     { 
 #if !(__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2))
-      if (_S_c_name != _M_name_timepunct)
+      if (_M_name_timepunct != _S_get_c_name())
        delete [] _M_name_timepunct;
 #endif
       delete _M_data; 
index d9502bd..e8f4e81 100644 (file)
@@ -224,10 +224,14 @@ namespace std
     static void
     _S_destroy_c_locale(__c_locale& __cloc);
 
-    // Returns data from the underlying "C" library for the classic locale.
+    // Returns data from the underlying "C" library data for the
+    // classic locale.
     static __c_locale
     _S_get_c_locale();
 
+    static const char*
+    _S_get_c_name();
+
   private:
     inline void
     _M_add_reference() const throw()
index 1ba83d1..7c1e8ab 100644 (file)
@@ -486,6 +486,10 @@ namespace std
     return _S_c_locale;
   }
 
+  const char*
+  locale::facet::_S_get_c_name()
+  { return _S_c_name; }
+
   // Definitions for static const data members of time_base.
   template<> 
     const char*
index cb71e2f..ba90ca4 100644 (file)
@@ -258,7 +258,7 @@ namespace std
     for (size_t __i = 0; __i < _S_categories_size; ++__i)
       {
        _M_names[__i] = new (&name_c[__i]) char[2];
-       std::strcpy(_M_names[__i], locale::facet::_S_c_name);
+       std::strcpy(_M_names[__i], locale::facet::_S_get_c_name());
       }
 
     // This is needed as presently the C++ version of "C" locales