[Patch] Remove _M_is_indeterminate, simplify _M_underflow.

Paolo Carlini pcarlini@unitus.it
Sun May 4 11:51:00 GMT 2003


Hi again,

this is more substantive (and more interesting!).
Consider the beginning of _M_underflow:

    //

    if (_M_in_cur < _M_in_end)
      {
        __ret = traits_type::to_int_type(*_M_in_cur);
        if (__bump)
          _M_move_in_cur(1);
        return __ret;
      }

    // Sync internal and external buffers.
    // NB: __testget -> __testput as _M_buf_unified here.
    const bool __testget = _M_in_beg < _M_in_cur;
    const bool __testinit = _M_is_indeterminate();
    if (__testget)
      {
        if (__testout)
          _M_overflow();
        else if (_M_in_cur != _M_filepos)
          _M_file.seekoff(_M_in_cur - _M_filepos,
                          ios_base::cur, __testsync, ios_base::in);
      }

    if (__testinit || __testget)
      {
        streamsize __elen = 0;
        streamsize __ilen = 0;

    //  

After the first 'if', either _M_in_cur == _M_in_end or they are both
NULL. Therefore, __testinit either is !__testget or is false because
there is no buffer, i.e., is redundant and can be removed, together
with _M_is_indeterminate(), not used anywhere else.

Tested x86-linux (+ 27_io/objects by hand + some other sanity checks).

Paolo.

//////////
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: CL_under_sub
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20030504/10fa48ca/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: patch_under_sub
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20030504/10fa48ca/attachment-0001.ksh>


More information about the Libstdc++ mailing list