stdcxx-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vi...@apache.org
Subject svn commit: r629207 - in /stdcxx/trunk/include: sstream sstream.cc
Date Tue, 19 Feb 2008 19:55:24 GMT
Author: vitek
Date: Tue Feb 19 11:55:21 2008
New Revision: 629207

URL: http://svn.apache.org/viewvc?rev=629207&view=rev
Log:

2008-02-19  Travis Vitek  <vitek@roguewave.com>

	STDCXX-602
	* include/sstream (_C_grow): Remove declaration and definition of
	private method.
	* include/sstream.cc (str): Calculate the appropriate buffer size
	directly, removing call to removed method _C_grow().


Modified:
    stdcxx/trunk/include/sstream
    stdcxx/trunk/include/sstream.cc

Modified: stdcxx/trunk/include/sstream
URL: http://svn.apache.org/viewvc/stdcxx/trunk/include/sstream?rev=629207&r1=629206&r2=629207&view=diff
==============================================================================
--- stdcxx/trunk/include/sstream (original)
+++ stdcxx/trunk/include/sstream Tue Feb 19 11:55:21 2008
@@ -170,8 +170,6 @@
 
 private:
 
-    _RWSTD_STREAMSIZE _C_grow (_RWSTD_STREAMSIZE) const;
-
     // called from overflow, underflow, et al to get egptr()
     // caught up with pptr()
     void _C_catchup (char_type*);
@@ -199,25 +197,6 @@
     }
 
     return _C_string_type (__first, __last);
-}
-
-
-template <class _CharT, class _Traits, class _Allocator>
-inline _RWSTD_STREAMSIZE
-basic_stringbuf<_CharT, _Traits, _Allocator>::
-_C_grow (_RWSTD_STREAMSIZE __to) const
-{
-    const _RWSTD_STREAMSIZE __ratio =
-        _RWSTD_STREAMSIZE (  (_RWSTD_NEW_CAPACITY_RATIO << 10)
-                           / _RWSTD_RATIO_DIVIDER);
-
-    const _RWSTD_STREAMSIZE __cap =
-        this->_C_bufsize ?
-          (this->_C_bufsize >> 10) * __ratio
-        + (((this->_C_bufsize & 0x3ff) * __ratio) >> 10)
-        : _RWSTD_MINIMUM_STRINGBUF_CAPACITY;
-
-    return __cap < __to ? __to : __cap;
 }
 
 

Modified: stdcxx/trunk/include/sstream.cc
URL: http://svn.apache.org/viewvc/stdcxx/trunk/include/sstream.cc?rev=629207&r1=629206&r2=629207&view=diff
==============================================================================
--- stdcxx/trunk/include/sstream.cc (original)
+++ stdcxx/trunk/include/sstream.cc Tue Feb 19 11:55:21 2008
@@ -99,7 +99,17 @@
     if (this->_C_bufsize < __bufsize) {
         // requested capacity is greater than the current capacity
         // allocate a new buffer of sufficient size
-        __bufsize = _C_grow (__bufsize);
+		const _RWSTD_STREAMSIZE __ratio =
+            _RWSTD_STREAMSIZE (  (_RWSTD_NEW_CAPACITY_RATIO << 10)
+                               / _RWSTD_RATIO_DIVIDER);
+
+        const _RWSTD_STREAMSIZE __cap =
+            this->_C_buffsize ?
+              (this->_C_buffsize >> 10) * __ratio
+            + (((this->_C_buffsize & 0x3ff) * __ratio) >> 10)
+            : _RWSTD_MINIMUM_STRINGBUF_CAPACITY;
+
+        __bufsize = __cap < __bufsize ? __bufsize : __cap;
 
         if (__s != this->_C_buffer && this->_C_own_buf ()) {
             // deallocate the existing buffer here only if the string



Mime
View raw message