This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Patch] Tidy basic_stringbuf::str()


Hi,

if nobody objects I'll commit the below, which just tidies
our current str(): not the functional improvement that I hoped
yesterday, but still sensibly simpler than the 3.3 version.

Tested x86-linux.

Paolo.

///////
2003-05-02  Paolo Carlini  <pcarlini@unitus.it>

	* include/std/std_sstream.h (str()): Tidy.
diff -prN libstdc++-v3-orig/include/std/std_sstream.h libstdc++-v3/include/std/std_sstream.h
*** libstdc++-v3-orig/include/std/std_sstream.h	Fri May  2 01:09:04 2003
--- libstdc++-v3/include/std/std_sstream.h	Fri May  2 22:12:48 2003
*************** namespace std
*** 133,147 ****
        __string_type
        str() const
        {
  	__string_type __ret = _M_string;
! 	if (this->_M_mode & ios_base::out)
! 	  {
! 	    const __size_type __nlen = this->_M_out_lim
!                                        - this->_M_out_beg;
! 	    if (__nlen)
! 	      __ret = __string_type(this->_M_out_beg, 
! 				    this->_M_out_beg + __nlen);
! 	  }
  	return __ret;
        }
  
--- 133,143 ----
        __string_type
        str() const
        {
+ 	const bool __testout = this->_M_mode & ios_base::out;
  	__string_type __ret = _M_string;
! 	if (__testout && this->_M_out_beg < this->_M_out_lim)
! 	  __ret = __string_type(this->_M_out_beg,
! 				this->_M_out_lim);
  	return __ret;
        }
  

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]