diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2012-01-02 18:00:40 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2012-01-02 18:01:42 +0100 |
commit | 9d54084d61afc45beeff76e84277e3b814b32a73 (patch) | |
tree | c543eb7c474482931e007877db50687dfcefc4d0 /cppu/source | |
parent | 13a40f304112a6c9ad232ea1de547e019b045e61 (diff) |
Replace dynamic array with std::vector.
Diffstat (limited to 'cppu/source')
-rw-r--r-- | cppu/source/typelib/typelib.cxx | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/cppu/source/typelib/typelib.cxx b/cppu/source/typelib/typelib.cxx index c197f731ff53..436781ef8920 100644 --- a/cppu/source/typelib/typelib.cxx +++ b/cppu/source/typelib/typelib.cxx @@ -287,20 +287,21 @@ TypeDescriptor_Init_Impl::~TypeDescriptor_Init_Impl() SAL_THROW( () ) if( pWeakMap ) { - sal_Int32 nSize = pWeakMap->size(); - typelib_TypeDescriptionReference ** ppTDR = new typelib_TypeDescriptionReference *[ nSize ]; + std::vector< typelib_TypeDescriptionReference * > ppTDR; // save al weak references WeakMap_Impl::const_iterator aIt = pWeakMap->begin(); - sal_Int32 i = 0; while( aIt != pWeakMap->end() ) { - typelib_typedescriptionreference_acquire( ppTDR[i++] = (*aIt).second ); + ppTDR.push_back( (*aIt).second ); + typelib_typedescriptionreference_acquire( ppTDR.back() ); ++aIt; } - for( i = 0; i < nSize; i++ ) + for( std::vector< typelib_TypeDescriptionReference * >::iterator i( + ppTDR.begin() ); + i != ppTDR.end(); ++i ) { - typelib_TypeDescriptionReference * pTDR = ppTDR[i]; + typelib_TypeDescriptionReference * pTDR = *i; OSL_ASSERT( pTDR->nRefCount > pTDR->nStaticRefCount ); pTDR->nRefCount -= pTDR->nStaticRefCount; @@ -312,8 +313,6 @@ TypeDescriptor_Init_Impl::~TypeDescriptor_Init_Impl() SAL_THROW( () ) typelib_typedescriptionreference_release( pTDR ); } - delete [] ppTDR; - #if OSL_DEBUG_LEVEL > 1 aIt = pWeakMap->begin(); while( aIt != pWeakMap->end() ) |