Author: sebor Date: Tue May 26 15:59:17 2009 New Revision: 778780 URL: http://svn.apache.org/viewvc?rev=778780&view=rev Log: 2009-05-26 Martin Sebor <se...@apache.org>
STDCXX-1036 * src/iosdata.h (ios_base::_C_usr_data::_C_alloc, ios_base::_C_usr_data::_C_dealloc): Moved functions from here... * src/iostore.cpp: ...to here and outlined to silence gcc 4.4 -Winline warnings. Modified: stdcxx/branches/4.2.x/src/iosdata.h stdcxx/branches/4.2.x/src/iostore.cpp Modified: stdcxx/branches/4.2.x/src/iosdata.h URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/src/iosdata.h?rev=778780&r1=778779&r2=778780&view=diff ============================================================================== --- stdcxx/branches/4.2.x/src/iosdata.h (original) +++ stdcxx/branches/4.2.x/src/iosdata.h Tue May 26 15:59:17 2009 @@ -22,7 +22,7 @@ * implied. See the License for the specific language governing * permissions and limitations under the License. * - * Copyright 1994-2006 Rogue Wave Software. + * Copyright 1994-2006 Rogue Wave Software, Inc. * **************************************************************************/ @@ -30,8 +30,6 @@ #define _RWSTD_IOSDATA_H_INCLUDED -#include <string.h> - #include <rw/_iosbase.h> #include <rw/_defs.h> @@ -68,66 +66,6 @@ static _C_usr_data _C_std_usr_data [2]; }; - -inline /* static */ ios_base::_C_usr_data* -ios_base::_C_usr_data::_C_alloc (_C_fire_fun pfire) -{ - _TRY { - // rely on 0-initialization of PODs - _C_usr_data* const pdata = new _C_usr_data (); - -#ifdef _RWSTD_NO_NEW_THROWS - - if (!pdata) - return 0; - -#endif // _RWSTD_NO_NEW_THROWS - - _RWSTD_ASSERT (0 != pdata); - -#ifndef _RWSTD_NO_POD_ZERO_INIT - - // assert that the POD ctor above zeroed out all members - _RWSTD_ASSERT (!pdata->_C_tie); - _RWSTD_ASSERT (!pdata->_C_iarray); - _RWSTD_ASSERT (!pdata->_C_parray); - _RWSTD_ASSERT (!pdata->_C_cbarray); - _RWSTD_ASSERT (!pdata->_C_isize); - _RWSTD_ASSERT (!pdata->_C_psize); - _RWSTD_ASSERT (!pdata->_C_cbsize); - -#else // if defined (_RWSTD_NO_POD_ZERO_INIT) - - memset (pdata, 0, sizeof *pdata); - -#endif // _RWSTD_NO_POD_ZERO_INIT - - pdata->_C_fire = pfire; - - return pdata; - } - _CATCH (...) { - return 0; - } -} - - -inline /* static */ void -ios_base::_C_usr_data::_C_dealloc (_C_usr_data *ptr) -{ - if (ptr) { - operator delete (ptr->_C_iarray); - operator delete (ptr->_C_parray); - operator delete (ptr->_C_cbarray); - - if ( ptr != _C_usr_data::_C_std_usr_data - && ptr != _C_usr_data::_C_std_usr_data + 1) - delete ptr; - } -} - - } // namespace std - #endif // _RWSTD_IOSDATA_H_INCLUDED Modified: stdcxx/branches/4.2.x/src/iostore.cpp URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/src/iostore.cpp?rev=778780&r1=778779&r2=778780&view=diff ============================================================================== --- stdcxx/branches/4.2.x/src/iostore.cpp (original) +++ stdcxx/branches/4.2.x/src/iostore.cpp Tue May 26 15:59:17 2009 @@ -84,6 +84,64 @@ _RWSTD_NAMESPACE (std) { +/* static */ ios_base::_C_usr_data* +ios_base::_C_usr_data::_C_alloc (_C_fire_fun pfire) +{ + _TRY { + // rely on zero-initialization of PODs + _C_usr_data* const pdata = new _C_usr_data (); + +#ifdef _RWSTD_NO_NEW_THROWS + + if (!pdata) + return 0; + +#endif // _RWSTD_NO_NEW_THROWS + + _RWSTD_ASSERT (0 != pdata); + +#ifndef _RWSTD_NO_POD_ZERO_INIT + + // assert that the POD ctor above zeroed out all members + _RWSTD_ASSERT (!pdata->_C_tie); + _RWSTD_ASSERT (!pdata->_C_iarray); + _RWSTD_ASSERT (!pdata->_C_parray); + _RWSTD_ASSERT (!pdata->_C_cbarray); + _RWSTD_ASSERT (!pdata->_C_isize); + _RWSTD_ASSERT (!pdata->_C_psize); + _RWSTD_ASSERT (!pdata->_C_cbsize); + +#else // if defined (_RWSTD_NO_POD_ZERO_INIT) + + memset (pdata, 0, sizeof *pdata); + +#endif // _RWSTD_NO_POD_ZERO_INIT + + pdata->_C_fire = pfire; + + return pdata; + } + _CATCH (...) { + return 0; + } +} + + +/* static */ void +ios_base::_C_usr_data::_C_dealloc (_C_usr_data *ptr) +{ + if (ptr) { + operator delete (ptr->_C_iarray); + operator delete (ptr->_C_parray); + operator delete (ptr->_C_cbarray); + + if ( ptr != _C_usr_data::_C_std_usr_data + && ptr != _C_usr_data::_C_std_usr_data + 1) + delete ptr; + } +} + + /* static */ int ios_base::xalloc () { // outlined to hide implementation details