Farid Zaripov wrote:
The throw_when_ mebmer of the MyStreambuf class (rw_streambuf.h line
183) is
not initialized at the moment in class ctor's (only zero'ed), but used
in
MyStreambuf::test() (lines 472, 483). I suppose that this class designed
to initialize
throw_when_ within test functions. But for now the all iostream tests
doesn't do it.
Maybe we just remove this mebmer at all? The patch is ready :)
I'm not dead set against removing it but if it ain't broke...?
Is it actually causing problems or are you just cleaning things
up?
Martin
ChangeLog:
* rw_streambuf.h: Removed MyStreambuf::throw_when_ member as unused.
Index: rw_streambuf.h
===================================================================
--- rw_streambuf.h (revision 555508)
+++ rw_streambuf.h (working copy)
@@ -180,7 +180,6 @@
int fail_when_; // call number on which to fail
- int throw_when_ [11]; // call number on which to throw for
each func
int allthrows_; // total number of thrown exceptions
// max size of the pending input sequence
@@ -219,9 +218,6 @@
// reset the member function call counters
std::memset (ncalls_, 0, sizeof ncalls_);
- // reset the member function throw counters
- std::memset (throw_when_, 0, sizeof throw_when_);
-
// allocate a (possibly wide) character buffer for output
buf_ = new charT [bufsize_];
@@ -252,9 +248,6 @@
// reset the member function call counters
std::memset (ncalls_, 0, sizeof ncalls_);
- // reset the member function throw counters
- std::memset (throw_when_, 0, sizeof throw_when_);
-
// as a convenience, if `bufsize == -1' compute the size
// from the length of `buf'
if (std::streamsize (-1) == bufsize_)
@@ -469,7 +462,7 @@
// if the call counter is equal to the `fail_when_' watermark
// and `shich' is set in the `throw_set_' bitmask, throw an
// exception with the value of the member id
- if (callno == throw_when_ [inx] && throw_set_ & which) {
+ if (callno == fail_when_ && throw_set_ & which) {
self->threw_ = which;
self->allthrows_++;
@@ -480,7 +473,7 @@
#else // if defined (_RWSTD_NO_EXCEPTIONS)
- if (callno == throw_when_ [inx] && throw_set_ & which) {
+ if (callno == fail_when_ && throw_set_ & which) {
self->threw_ = which;
return false;
}
Farid.