[kgraphviewer-devel] Re: optimize map loops

Gaël (aka Kleag) kleag at free.fr
Sun Nov 7 18:24:49 CET 2010


I just looked at the repository: your push worked ! So, I don't know what the 
error message refers to.

Gaël
Le dimanche 7 novembre 2010 16:26:35, Milian Wolff a écrit :
> On Sunday 07 November 2010 16:22:10 Milian Wolff wrote:
> > Hey Gael,
> > 
> > Albert reviewed parts of kgraphviewer and spotted things like this:
> >   QList<QString> edgesKeys = edges().keys();
> >   foreach (const QString& eid, edgesKeys)
> >   {
> >   
> >     GraphEdge* edge = edges()[eid];
> > 
> > This is like the worst possible way to iterate over maps you can imagine.
> > 
> > Instead you should write it like this:
> >   QMap<QString, GraphEdge*>::const_iterator it = edges().constBegin();
> >   while (it != edges().constEnd()) {
> >   
> >      // use it.value() and it.key() here
> >      ++it;
> >   
> >   }
> > 
> > Though looking at the sources, one can even rewrite them much simpler,
> > I'll commit it, please review it then.
> 
> I just tried to push but it failed, Gael - did you enable the hooks?
> 
> See also: http://community.kde.org/Sysadmin/GitKdeOrgManual#hooks-enable
> 
> My error:
> Counting objects: 9, done.
> Delta compression using up to 2 threads.
> Compressing objects: 100% (5/5), done.
> Writing objects: 100% (5/5), 551 bytes, done.
> Total 5 (delta 4), reused 0 (delta 0)
> remote: Auditing commits, please wait ...
> remote: ***** NOTICE *****
> remote: ** Post commit hooks are DISABLED
> remote: ** Push access is restricted to repository admins
> remote: ***** NOTICE *****
> remote: Poking gitweb for immediate commit URL resolving...
> To git at git.kde.org:kgraphviewer
>    651d41c..0c126f1  master -> master

-- 
KsirK - a world domination strategy game 
http://techbase.kde.org/Projects/Games/Tactic_and_Strategy/KsirK

KGraphViewer - a GraphViz dot graphs viewer and editor based on a reusable 
part
http://extragear.kde.org/apps/kgraphviewer


More information about the kgraphviewer-devel mailing list