summaryrefslogtreecommitdiff
path: root/libstdc++-v3/src
diff options
context:
space:
mode:
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>2004-10-17 14:46:29 +0000
committerpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>2004-10-17 14:46:29 +0000
commitb623a505b830e04cf389ba71bf7453f5ab6cda3e (patch)
treebe1b6bd5b751bc3bdce3980e9e7aedd6a86c8e15 /libstdc++-v3/src
parentd603d8be1c82455fa6b0d63655eb1346c74d8d93 (diff)
downloadgcc-b623a505b830e04cf389ba71bf7453f5ab6cda3e.tar.gz
2004-10-17 Dhruv Matani <dhruvbird@gmx.net>
Paolo Carlini <pcarlini@suse.de> * include/ext/bitmap_allocator.h: Change unsigned int -> size_t: this makes the code 64-bit correct and also fixes (together with using at the beginning a bitmap 2 * size_t bytes wide) alignment issues: now 8 is guaranteed, easily tunable to 16 via _BALLOC_ALIGN_BYTES. Fix pthread-rope7.cc fail by nulling out __mini_vector<> destructor. * src/bitmap_allocator.cc: Change to size_t. * config/linker-map.gnu: Adjust. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@89170 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/src')
-rw-r--r--libstdc++-v3/src/bitmap_allocator.cc28
1 files changed, 13 insertions, 15 deletions
diff --git a/libstdc++-v3/src/bitmap_allocator.cc b/libstdc++-v3/src/bitmap_allocator.cc
index 3cd0fb90e3f..b953ffdd876 100644
--- a/libstdc++-v3/src/bitmap_allocator.cc
+++ b/libstdc++-v3/src/bitmap_allocator.cc
@@ -41,11 +41,11 @@ namespace __gnu_cxx
<bitmap_allocator<wchar_t>::_Alloc_block*,
bitmap_allocator<wchar_t>::_Alloc_block*> >;
- template class __mini_vector<unsigned int*>;
+ template class __mini_vector<size_t*>;
- template unsigned int** __lower_bound
- (unsigned int**, unsigned int**,
- unsigned int const&, free_list::_LT_pointer_compare);
+ template size_t** __lower_bound
+ (size_t**, size_t**,
+ size_t const&, free_list::_LT_pointer_compare);
}
#if defined __GTHREADS
@@ -53,9 +53,9 @@ namespace __gnu_cxx
#endif
free_list::vector_type free_list::_S_free_list;
- unsigned int*
+ size_t*
free_list::
- _M_get(unsigned int __sz) throw(std::bad_alloc)
+ _M_get(size_t __sz) throw(std::bad_alloc)
{
#if defined __GTHREADS
_Lock __bfl_lock(&_S_bfl_mutex);
@@ -77,15 +77,15 @@ namespace __gnu_cxx
// Try twice to get the memory: once directly, and the 2nd
// time after clearing the free list. If both fail, then
// throw std::bad_alloc().
- unsigned int __ctr = 2;
+ int __ctr = 2;
while (__ctr)
{
- unsigned int* __ret = 0;
+ size_t* __ret = 0;
--__ctr;
try
{
- __ret = reinterpret_cast<unsigned int*>
- (::operator new(__sz + sizeof(unsigned int)));
+ __ret = reinterpret_cast<size_t*>
+ (::operator new(__sz + sizeof(size_t)));
}
catch(...)
{
@@ -94,20 +94,18 @@ namespace __gnu_cxx
if (!__ret)
continue;
*__ret = __sz;
- return reinterpret_cast<unsigned int*>
- (reinterpret_cast<char*>(__ret) + sizeof(unsigned int));
+ return __ret + 1;
}
throw std::bad_alloc();
}
else
{
- unsigned int* __ret = *__temp;
+ size_t* __ret = *__temp;
_S_free_list.erase(__temp);
#if defined __GTHREADS
__bfl_lock._M_unlock();
#endif
- return reinterpret_cast<unsigned int*>
- (reinterpret_cast<char*>(__ret) + sizeof(unsigned int));
+ return __ret + 1;
}
}