[Libreoffice] [PATCH] Replace SvULongs with vector and code clean up part 1

Eike Rathke ooo at erack.de
Sun Aug 7 02:17:54 PDT 2011


Hi Maciej,

On Saturday, 2011-08-06 19:59:40 +0200, Maciej Rumianowski wrote:

> > >              DBG_ASSERT( bFound, "Key not found" );
> > > -            aDelList.Remove( nAt );
> > > +            aDelList.erase( nAt );
> > 
> > Hmm.. I'd say the original code was wrong, when nAddKey was not found
> > in
> > aDelList it removed the first element anyway. That should be
> > 
> >                if (bFound)
> >                    aDelList.erase( nAt );
> > 
> > instead. 
> There was so many questions that I forgot to ask. Should this code be
> more changed? Because code in if(isRemoved_Impl()) is only entered if
> there is nAddKey in aDelList. My question is why the key is double
> searched? I think assertion will never be met.

You're right, the code is "suboptimal" ... in fact IsRemoved_Impl() and
IsAdded_Impl() could also return the index of the element found so it
wouldn't be needed to be searched again. Want to take care of it?

  Eike

-- 
 PGP/OpenPGP/GnuPG encrypted mail preferred in all private communication.
 Key ID: 0x293C05FD - 997A 4C60 CE41 0149 0DB3  9E96 2F1A D073 293C 05FD
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20110807/190be80c/attachment.pgp>


More information about the LibreOffice mailing list