diff options
author | bkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-08-02 16:04:16 +0000 |
---|---|---|
committer | bkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-08-02 16:04:16 +0000 |
commit | 3aba0096b6c3d315553a253dfc83b3e802ed4781 (patch) | |
tree | f09969269dffbedb05335c80ca06847521a7611c /libstdc++-v3/src/strstream.cc | |
parent | 428fa5f709fabc0ef1cebd6e9022c6871252de76 (diff) | |
download | gcc-3aba0096b6c3d315553a253dfc83b3e802ed4781.tar.gz |
2002-08-02 Benjamin Kosnik <bkoz@redhat.com>
Revert PR libstdc++/6594
* src/strstream.cc (strstreambuf): Revert.
(strstreambuf::overflow): Same.
(strstreambuf::~strstreambuf): Same.
* testsuite/backward/strstream_members.cc (test02): Add.
* docs/html/abi.txt: Update. Spell check.
* testsuite/19_diagnostics/stdexceptions.cc (test04): Add bool test.
* testsuite/Makefile.am (INCLUDES): Add LIBSUPCXX_INCLUDES.
* testsuite/Makefile.in: Regenerate.
* testsuite/testsuite_hooks.h: Use __throw_exception_again,
include functexcept.h so that -fno-exceptions will build.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@55988 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/src/strstream.cc')
-rw-r--r-- | libstdc++-v3/src/strstream.cc | 33 |
1 files changed, 13 insertions, 20 deletions
diff --git a/libstdc++-v3/src/strstream.cc b/libstdc++-v3/src/strstream.cc index 7252afde323..0576472ddbe 100644 --- a/libstdc++-v3/src/strstream.cc +++ b/libstdc++-v3/src/strstream.cc @@ -60,12 +60,13 @@ namespace std : _Base(), _M_alloc_fun(0), _M_free_fun(0), _M_dynamic(true), _M_frozen(false), _M_constant(false) { - _M_buf_size = _M_buf_size_opt = max(initial_capacity, streamsize(16)); - _M_buf = _M_alloc(_M_buf_size); - if (_M_buf) + streamsize n = max(initial_capacity, streamsize(16)); + + char* buf = _M_alloc(n); + if (buf) { - setp(_M_buf, _M_buf + _M_buf_size); - setg(_M_buf, _M_buf, _M_buf); + setp(buf, buf + n); + setg(buf, buf, buf); } } @@ -73,12 +74,13 @@ namespace std : _Base(), _M_alloc_fun(alloc_f), _M_free_fun(free_f), _M_dynamic(true), _M_frozen(false), _M_constant(false) { - _M_buf_size = _M_buf_size_opt = 16; - _M_buf = _M_alloc(_M_buf_size); - if (_M_buf) + streamsize n = 16; + + char* buf = _M_alloc(n); + if (buf) { - setp(_M_buf, _M_buf + _M_buf_size); - setg(_M_buf, _M_buf, _M_buf); + setp(buf, buf + n); + setg(buf, buf, buf); } } @@ -116,14 +118,7 @@ namespace std strstreambuf::~strstreambuf() { if (_M_dynamic && !_M_frozen) - { - char* p = this->eback(); - _M_free(p); - if (p == _M_buf) - _M_buf = 0; - } - if (_M_buf) - _M_free(_M_buf); + _M_free(eback()); } void @@ -169,8 +164,6 @@ namespace std old_get_offset = gptr() - eback(); } - _M_buf = buf; - _M_buf_size = _M_buf_size_opt = new_size; setp(buf, buf + new_size); pbump(old_size); |