+2002-08-06 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.
+
+ * testsuite/19_diagnostics/stdexceptions.cc (test04): Add bool test.
+
2002-08-01 Benjamin Kosnik <bkoz@redhat.com>
Jakub Jelinek <jakub@redhat.com>
// MAY BE REMOVED in a future standard revision. You should use the
// header <sstream> instead.
-#include <strstream.h>
+#include <strstream>
#include <algorithm>
#include <new>
#include <stdlib.h>
: _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);
}
}
: _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);
}
}
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
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);