incubator-stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Sebor <se...@roguewave.com>
Subject Re: svn commit: r629584 - /stdcxx/trunk/include/string.cc
Date Fri, 22 Feb 2008 19:38:38 GMT
faridz@apache.org wrote:
> Author: faridz
> Date: Wed Feb 20 11:37:12 2008
> New Revision: 629584
> 
> URL: http://svn.apache.org/viewvc?rev=629584&view=rev
> Log:
> 2008-02-20 Farid Zaripov <farid_zaripov@epam.com>
> 
> 	* include/string.cc (__rw_replace): Removed unused variable __delta.
> 	(__rw_replace_aux): Removed unused typedef. Used ::operator new() and
> 	::operator delete() instead of std::allocator::allocate() and
> 	std::allocator::deallocate() respectively (since private base class
> 	std::allocator is not accessible in __rw_replace_aux()).

I don't think we're allowed to bypass the allocator and call new
directly.

Martin

> 
> Modified:
>     stdcxx/trunk/include/string.cc
> 
> Modified: stdcxx/trunk/include/string.cc
> URL: http://svn.apache.org/viewvc/stdcxx/trunk/include/string.cc?rev=629584&r1=629583&r2=629584&view=diff
> ==============================================================================
> --- stdcxx/trunk/include/string.cc (original)
> +++ stdcxx/trunk/include/string.cc Wed Feb 20 11:37:12 2008
> @@ -535,8 +535,6 @@
>              // compute the size of new buffer
>              const size_type __cap = __s3._C_grow (__s3.size (), size_type ());
>  
> -            const size_type __delta = __cap - __s3.size ();
> -
>              // allocate a new buffer
>              _C_string_ref_type *__tmp = __s3._C_get_rep (__cap, __cap);
>  
> @@ -582,9 +580,6 @@
>      typedef _RW::__string_ref<value_type, traits_type, allocator_type>
>      _C_string_ref_type;
>  
> -    typedef _RWSTD_ALLOC_TYPE (allocator_type, value_type)
> -    _C_value_alloc_type;
> -
>  #  else   // if !defined (_RWSTD_NO_STRING_OUTLINED_MEMBER_TEMPLATES)
>  
>  template<class _CharT, class _Traits, class _Allocator>
> @@ -660,8 +655,9 @@
>                      &_RWSTD_REINTERPRET_CAST (const_reference, *__first2);
>  
>                  if (__s.data () <= __ptr && __s.data () + __ssize > __ptr)
{
> -                    __tmp = _RWSTD_VALUE_ALLOC (_C_value_alloc_type, __s,
> -                                                allocate (__n2));
> +                    const _RWSTD_SIZE_T __tmp_size = __n2 * sizeof (value_type);
> +                    __tmp = _RWSTD_STATIC_CAST (pointer,
> +                                                ::operator new (__tmp_size));
>                      for (__d = 0; __d < __n2; __d++)
>                          traits_type::assign (*(__tmp + __d), *__first2++);
>                  }
> @@ -674,8 +670,7 @@
>  
>              if (__tmp) {
>                  traits_type::copy (__s._C_data + __pos, __tmp, __n2);
> -                _RWSTD_VALUE_ALLOC (_C_value_alloc_type, __s,
> -                                    deallocate (__tmp, __n2));
> +                ::operator delete (__tmp);
>              }
>              else {
>                  for (__d = 0; __d < __n2; __d++)
> 
> 


Mime
View raw message