Patches for the allocators (malloc/debug).

Dhruv Matani dhruvbird@HotPOP.com
Fri Mar 5 10:47:00 GMT 2004


Hello,

I don't know what the intention was in making malloc_allocator not throw
anything but that makes it non-compliant, and also the user is not
warned about any unsuccessful allocations, So I have added that check.

Also, I have added another check in debug_allocator for checking whether
a NULL pointer was passed.


-- 
	-Dhruv Matani.
http://www.geocities.com/dhruvbird/

Proud to be a Vegetarian.
http://www.vegetarianstarterkit.com/
http://www.vegkids.com/vegkids/index.html
-------------- next part --------------
2004-03-05  Dhruv Matani  <dhruvbird@gmx.net>

	* ext/malloc_allocator.h: Fixed the construct function to call
	global placement new instead of assignment. Added a check after
	the return from malloc to check whether returned pointer is NULL,
	and if so, throw std::bad_alloc().
	* ext/debug_allocator.h: Added a check in the deallocate function
	to check whether the user has passed a NULL pointer or not.
	

-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.allocators.dhruv.05032004
Type: text/x-patch
Size: 2676 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20040305/e474edaa/attachment.bin>


More information about the Libstdc++ mailing list