[Stlport-devel] exceptions
Brought to you by:
complement
From: Petr O. <pt...@is...> - 2007-05-16 06:00:05
|
+ * stlport/stl/_stdexcept_base.h, _stdexcept_base.c: __Names_exception + do not truncate anymore exception message when longer than internal + static buffer, a dynamic buffer is allocated through malloc in this + case. I haven't use __iostring class in this case as it would + have introduce a cyclic dependency between classes. +__Named_exception::__Named_exception(const string& __str) { + size_t __size = strlen(__get_c_string(__str)) + 1; + if (__size > _S_bufsize) { + _M_name = (char*)malloc(__size * sizeof(char)); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + if (_M_name == 0) { + __size = _S_bufsize; + _M_name = _M_static_name; + } + } + else { + _M_name = _M_static_name; + } Well, and what about bad_alloc and exception due to memory limits? IMO no dynamic allocation should happen during exception generation. - ptr |