aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Kosnik <bkoz@redhat.com>2003-12-15 19:48:50 +0000
committerBenjamin Kosnik <bkoz@gcc.gnu.org>2003-12-15 19:48:50 +0000
commit1313d87fd3b9ee56853aa911dee90e4882191de8 (patch)
tree32ffbe60809154dd55ece6b42565361518fdf193
parent61a8f1edff4604fcb4238391de4ca033ab4d9de3 (diff)
downloadgcc-1313d87fd3b9ee56853aa911dee90e4882191de8.zip
gcc-1313d87fd3b9ee56853aa911dee90e4882191de8.tar.gz
gcc-1313d87fd3b9ee56853aa911dee90e4882191de8.tar.bz2
basic_string.h: Change _*_references to _*_refcount.
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
-rw-r--r--libstdc++-v3/ChangeLog8
-rw-r--r--libstdc++-v3/include/bits/basic_string.h16
-rw-r--r--libstdc++-v3/include/bits/locale_classes.h16
-rw-r--r--libstdc++-v3/src/locale.cc6
-rw-r--r--libstdc++-v3/src/locale_init.cc2
-rw-r--r--libstdc++-v3/src/localename.cc2
6 files changed, 29 insertions, 21 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index c64b3aa..fc10ab7 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -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.
diff --git a/libstdc++-v3/include/bits/basic_string.h b/libstdc++-v3/include/bits/basic_string.h
index 7b1ba5c..e3d19b2 100644
--- a/libstdc++-v3/include/bits/basic_string.h
+++ b/libstdc++-v3/include/bits/basic_string.h
@@ -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
diff --git a/libstdc++-v3/include/bits/locale_classes.h b/libstdc++-v3/include/bits/locale_classes.h
index 62dabff..5d9722e 100644
--- a/libstdc++-v3/include/bits/locale_classes.h
+++ b/libstdc++-v3/include/bits/locale_classes.h
@@ -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; }
diff --git a/libstdc++-v3/src/locale.cc b/libstdc++-v3/src/locale.cc
index c3e5786..c9562e2 100644
--- a/libstdc++-v3/src/locale.cc
+++ b/libstdc++-v3/src/locale.cc
@@ -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
diff --git a/libstdc++-v3/src/locale_init.cc b/libstdc++-v3/src/locale_init.cc
index c72be4a..a71bb5d 100644
--- a/libstdc++-v3/src/locale_init.cc
+++ b/libstdc++-v3/src/locale_init.cc
@@ -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];
diff --git a/libstdc++-v3/src/localename.cc b/libstdc++-v3/src/localename.cc
index 2c12ba7..c6a7de9 100644
--- a/libstdc++-v3/src/localename.cc
+++ b/libstdc++-v3/src/localename.cc
@@ -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.