[Kde-games-devel] Palapeli -> kdereview

Stefan Majewsky majewsky at gmx.net
Wed Nov 11 10:13:36 CET 2009


Am Dienstag 10 November 2009 19:57:15 schrieb Albert Astals Cid:
> A comment on code, you have one or two places where do you things like
> 
> QList<int> pieceIndices = pieces.keys();
> foreach (int index, pieceIndices)
> {
>   if (!pieces[index].save(cachePath + QString("%1.png").arg(index)))
>   {
>     std::cerr << "Could not save piece image no. " << index << std::endl;
>     return 1;
>   }
> }
> 
> That is asking for the keys of a map and then iterating them to access the
>  map values, this is highly inefficient both in memory and time and you
>  should use a QMap::const_iterator in these cases

Fixed in r1047398, thanks for the hint.

Greetings
Stefan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
Url : http://mail.kde.org/pipermail/kde-games-devel/attachments/20091111/72b841f1/attachment.sig 


More information about the kde-games-devel mailing list