basic_string.h: Change _*_references to _*_refcount.
authorBenjamin Kosnik <bkoz@redhat.com>
Mon, 15 Dec 2003 19:48:50 +0000 (19:48 +0000)
committerBenjamin Kosnik <bkoz@gcc.gnu.org>
Mon, 15 Dec 2003 19:48:50 +0000 (19:48 +0000)
2003-12-15  Benjamin Kosnik  <bkoz@redhat.com>

* include/bits/basic_string.h: Change _*_references to _*_refcount.
* include/bits/locale_classes.h: Same.
* src/locale.cc: Same.
* src/locale_name.cc: Same.
* src/locale_init.cc: Same.

From-SVN: r74645

libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/basic_string.h
libstdc++-v3/include/bits/locale_classes.h
libstdc++-v3/src/locale.cc
libstdc++-v3/src/locale_init.cc
libstdc++-v3/src/localename.cc

index c64b3aa..fc10ab7 100644 (file)
@@ -1,5 +1,13 @@
 2003-12-15  Benjamin Kosnik  <bkoz@redhat.com>
 
+       * include/bits/basic_string.h: Change _*_references to _*_refcount.
+       * include/bits/locale_classes.h: Same.
+       * src/locale.cc: Same.
+       * src/locale_name.cc: Same.     
+       * src/locale_init.cc: Same.     
+       
+2003-12-15  Benjamin Kosnik  <bkoz@redhat.com>
+
        PR libstdc++/12855      
        * include/bits/ios_base.h (Init::_S_ios_base_init): Change to
        _S_refcount, make atomic.
index 7b1ba5c..e3d19b2 100644 (file)
@@ -134,7 +134,7 @@ namespace std
       //      _CharT() where the interface does not require it.
       //   2. _M_capacity >= _M_length
       //      Allocated memory is always _M_capacity + (1 * sizeof(_CharT)).
-      //   3. _M_references has three states:
+      //   3. _M_refcount has three states:
       //      -1: leaked, one reference, no ref-copies allowed, non-const.
       //       0: one reference, non-const.
       //     n>0: n + 1 references, operations require a lock, const.
@@ -146,7 +146,7 @@ namespace std
       {
        size_type               _M_length;
        size_type               _M_capacity;
-       _Atomic_word            _M_references;
+       _Atomic_word            _M_refcount;
       };
 
       struct _Rep : _Rep_base
@@ -180,19 +180,19 @@ namespace std
  
         bool
        _M_is_leaked() const
-        { return this->_M_references < 0; }
+        { return this->_M_refcount < 0; }
 
         bool
        _M_is_shared() const
-        { return this->_M_references > 0; }
+        { return this->_M_refcount > 0; }
 
         void
        _M_set_leaked()
-        { this->_M_references = -1; }
+        { this->_M_refcount = -1; }
 
         void
        _M_set_sharable()
-        { this->_M_references = 0; }
+        { this->_M_refcount = 0; }
 
        _CharT*
        _M_refdata() throw()
@@ -217,7 +217,7 @@ namespace std
        _M_dispose(const _Alloc& __a)
        {
          if (__builtin_expect(this != &_S_empty_rep(), false))
-           if (__exchange_and_add(&this->_M_references, -1) <= 0)
+           if (__exchange_and_add(&this->_M_refcount, -1) <= 0)
              _M_destroy(__a);
        }  // XXX MT
 
@@ -228,7 +228,7 @@ namespace std
        _M_refcopy() throw()
        {
          if (__builtin_expect(this != &_S_empty_rep(), false))
-            __atomic_add(&this->_M_references, 1);
+            __atomic_add(&this->_M_refcount, 1);
          return _M_refdata();
        }  // XXX MT
 
index 62dabff..5d9722e 100644 (file)
@@ -191,7 +191,7 @@ namespace std
     friend class locale;
     friend class locale::_Impl;
 
-    mutable _Atomic_word               _M_references;
+    mutable _Atomic_word               _M_refcount;
 
     // Contains data from the underlying "C" library for the classic locale.
     static __c_locale                   _S_c_locale;
@@ -208,7 +208,7 @@ namespace std
 
   protected:
     explicit 
-    facet(size_t __refs = 0) throw() : _M_references(__refs ? 1 : 0)
+    facet(size_t __refs = 0) throw() : _M_refcount(__refs ? 1 : 0)
     { }
 
     virtual 
@@ -235,12 +235,12 @@ namespace std
   private:
     inline void
     _M_add_reference() const throw()
-    { __atomic_add(&_M_references, 1); }
+    { __atomic_add(&_M_refcount, 1); }
 
     inline void
     _M_remove_reference() const throw()
     {
-      if (__exchange_and_add(&_M_references, -1) == 1)
+      if (__exchange_and_add(&_M_refcount, -1) == 1)
        {
          try 
            { delete this; }  
@@ -277,7 +277,7 @@ namespace std
     mutable size_t             _M_index;
 
     // Last id number assigned.
-    static _Atomic_word        _S_highwater;   
+    static _Atomic_word        _S_refcount;   
 
     void 
     operator=(const id&);  // Not defined.
@@ -315,7 +315,7 @@ namespace std
 
   private:
     // Data Members.
-    _Atomic_word                       _M_references;
+    _Atomic_word                       _M_refcount;
     const facet**                      _M_facets;
     size_t                             _M_facets_size;
     const facet**                      _M_caches;
@@ -330,12 +330,12 @@ namespace std
 
     inline void 
     _M_add_reference() throw()
-    { __atomic_add(&_M_references, 1); }
+    { __atomic_add(&_M_refcount, 1); }
 
     inline void 
     _M_remove_reference() throw()
     {
-      if (__exchange_and_add(&_M_references, -1) == 1)
+      if (__exchange_and_add(&_M_refcount, -1) == 1)
        {
          try 
            { delete this; } 
index c3e5786..c9562e2 100644 (file)
@@ -211,7 +211,7 @@ namespace std
   // Clone existing _Impl object.
   locale::_Impl::
   _Impl(const _Impl& __imp, size_t __refs)
-  : _M_references(__refs), _M_facets_size(__imp._M_facets_size)
+  : _M_refcount(__refs), _M_facets_size(__imp._M_facets_size)
   {
     _M_facets = _M_caches = 0;
     _M_names = 0;
@@ -350,13 +350,13 @@ namespace std
 
   // locale::id
   // Definitions for static const data members of locale::id
-  _Atomic_word locale::id::_S_highwater;  // init'd to 0 by linker
+  _Atomic_word locale::id::_S_refcount;  // init'd to 0 by linker
 
   size_t
   locale::id::_M_id() const
   {
     if (!_M_index)
-      _M_index = 1 + __exchange_and_add(&_S_highwater, 1);
+      _M_index = 1 + __exchange_and_add(&_S_refcount, 1);
     return _M_index - 1;
   }
 } // namespace std
index c72be4a..a71bb5d 100644 (file)
@@ -241,7 +241,7 @@ namespace std
   // Construct "C" _Impl.
   locale::_Impl::
   _Impl(size_t __refs) throw() 
-  : _M_references(__refs), _M_facets_size(_GLIBCXX_NUM_FACETS)
+  : _M_refcount(__refs), _M_facets_size(_GLIBCXX_NUM_FACETS)
   {
     _M_facets = new (&facet_vec) const facet*[_M_facets_size];
     _M_caches = new (&cache_vec) const facet*[_M_facets_size];
index 2c12ba7..c6a7de9 100644 (file)
@@ -178,7 +178,7 @@ namespace std
   // Construct named _Impl.
   locale::_Impl::
   _Impl(const char* __s, size_t __refs) 
-  : _M_references(__refs), _M_facets_size(_GLIBCXX_NUM_FACETS)
+  : _M_refcount(__refs), _M_facets_size(_GLIBCXX_NUM_FACETS)
   {
     // Initialize the underlying locale model, which also checks to
     // see if the given name is valid.