bitmap_allocator.h: Qualify ::operator delete.
2004-10-15 Paolo Carlini <pcarlini@suse.de> * include/ext/bitmap_allocator.h: Qualify ::operator delete. * src/bitmap_allocator.cc: Likewise. * src/mt_allocator.cc: Use ::operator delete, not delete, consistently with ::operator new. * include/ext/bitmap_allocator.h (deallocate): Check for null pointer. * testsuite/ext/bitmap_allocator/check_deallocate_null.cc: New. * testsuite/testsuite_allocator.h (check_deallocate_null): Add test. From-SVN: r89089
This commit is contained in:
parent
31246b8f0d
commit
0d6b41f2dd
@ -1,3 +1,15 @@
|
||||
2004-10-15 Paolo Carlini <pcarlini@suse.de>
|
||||
|
||||
* include/ext/bitmap_allocator.h: Qualify ::operator delete.
|
||||
* src/bitmap_allocator.cc: Likewise.
|
||||
* src/mt_allocator.cc: Use ::operator delete, not delete,
|
||||
consistently with ::operator new.
|
||||
|
||||
* include/ext/bitmap_allocator.h (deallocate): Check for null
|
||||
pointer.
|
||||
* testsuite/ext/bitmap_allocator/check_deallocate_null.cc: New.
|
||||
* testsuite/testsuite_allocator.h (check_deallocate_null): Add test.
|
||||
|
||||
2004-10-14 Benjamin Kosnik <bkoz@redhat.com>
|
||||
|
||||
* include/ext/mt_allocator.h (__mt_alloc::deallocate): Check for
|
||||
|
@ -674,14 +674,14 @@ namespace __gnu_cxx
|
||||
// Ok, the new block is greater than or equal to the
|
||||
// last block in the list of free blocks. We just free
|
||||
// the new block.
|
||||
operator delete(static_cast<void*>(__addr));
|
||||
::operator delete(static_cast<void*>(__addr));
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Deallocate the last block in the list of free lists,
|
||||
// and insert the new one in it's correct position.
|
||||
operator delete(static_cast<void*>(_S_free_list.back()));
|
||||
::operator delete(static_cast<void*>(_S_free_list.back()));
|
||||
_S_free_list.pop_back();
|
||||
}
|
||||
}
|
||||
@ -1095,10 +1095,13 @@ namespace __gnu_cxx
|
||||
void
|
||||
deallocate(pointer __p, size_type __n) throw()
|
||||
{
|
||||
if (__builtin_expect(__n == 1, true))
|
||||
this->_M_deallocate_single_object(__p);
|
||||
else
|
||||
::operator delete(__p);
|
||||
if (__builtin_expect(__p != 0, true))
|
||||
{
|
||||
if (__builtin_expect(__n == 1, true))
|
||||
this->_M_deallocate_single_object(__p);
|
||||
else
|
||||
::operator delete(__p);
|
||||
}
|
||||
}
|
||||
|
||||
pointer
|
||||
|
@ -121,7 +121,7 @@ namespace __gnu_cxx
|
||||
iterator __iter = _S_free_list.begin();
|
||||
while (__iter != _S_free_list.end())
|
||||
{
|
||||
operator delete((void*)*__iter);
|
||||
::operator delete((void*)*__iter);
|
||||
++__iter;
|
||||
}
|
||||
_S_free_list.clear();
|
||||
|
@ -61,10 +61,10 @@ namespace __gnu_cxx
|
||||
delete __bin._M_address;
|
||||
__bin._M_address = __tmp;
|
||||
}
|
||||
delete __bin._M_first;
|
||||
::operator delete(__bin._M_first);
|
||||
}
|
||||
delete _M_bin;
|
||||
delete _M_binmap;
|
||||
::operator delete(_M_bin);
|
||||
::operator delete(_M_binmap);
|
||||
}
|
||||
}
|
||||
|
||||
@ -190,10 +190,10 @@ namespace __gnu_cxx
|
||||
delete __bin._M_address;
|
||||
__bin._M_address = __tmp;
|
||||
}
|
||||
delete __bin._M_first;
|
||||
delete __bin._M_free;
|
||||
delete __bin._M_used;
|
||||
delete __bin._M_mutex;
|
||||
::operator delete(__bin._M_first);
|
||||
::operator delete(__bin._M_free);
|
||||
::operator delete(__bin._M_used);
|
||||
::operator delete(__bin._M_mutex);
|
||||
}
|
||||
::operator delete(_M_thread_freelist_initial);
|
||||
}
|
||||
@ -209,11 +209,11 @@ namespace __gnu_cxx
|
||||
delete __bin._M_address;
|
||||
__bin._M_address = __tmp;
|
||||
}
|
||||
delete __bin._M_first;
|
||||
::operator delete(__bin._M_first);
|
||||
}
|
||||
}
|
||||
delete _M_bin;
|
||||
delete _M_binmap;
|
||||
::operator delete(_M_bin);
|
||||
::operator delete(_M_binmap);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,31 @@
|
||||
//
|
||||
// Copyright (C) 2004 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 2, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING. If not, write to the Free
|
||||
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
// USA.
|
||||
|
||||
// 20.4.1.1 allocator members
|
||||
|
||||
#include <ext/bitmap_allocator.h>
|
||||
#include <testsuite_allocator.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
typedef int value_type;
|
||||
typedef __gnu_cxx::bitmap_allocator<value_type> allocator_type;
|
||||
__gnu_test::check_deallocate_null<allocator_type>();
|
||||
return 0;
|
||||
}
|
@ -202,6 +202,7 @@ namespace __gnu_test
|
||||
{
|
||||
// Let's not core here...
|
||||
Alloc a;
|
||||
a.deallocate(NULL, 1);
|
||||
a.deallocate(NULL, 10);
|
||||
}
|
||||
}; // namespace __gnu_test
|
||||
|
Loading…
Reference in New Issue
Block a user