> On Jan. 29, 2013, 7:25 p.m., Dario Freddi wrote: > > powerdevil/daemon/powerdevilpolicyagent.cpp, line 508 > > <http://git.reviewboard.kde.org/r/107698/diff/1/?file=98809#file98809line508> > > > > I wouldn't use key() for that, as there is no guarantee AFAIK that if > > not found, it would return 0 (it usually returns a default constructed key, > > which in case of an int could be pretty much any value.). > > > > As such, I either propose .key(service, 0), which guarantees the > > returned key would be 0 if not existent; or .values().contains(service). > > I'd choose the second for clarity.
I did worry about that, but according to http://qt-project.org/doc/qt-4.8/containers.html#default-constructed-values it's safe: "But for primitive types like int and double, as well as for pointer types, the C++ language doesn't specify any initialization; in those cases, Qt's containers automatically initialize the value to 0." - Oliver ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: http://git.reviewboard.kde.org/r/107698/#review26380 ----------------------------------------------------------- On Dec. 13, 2012, 12:55 p.m., Oliver Henshaw wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > http://git.reviewboard.kde.org/r/107698/ > ----------------------------------------------------------- > > (Updated Dec. 13, 2012, 12:55 p.m.) > > > Review request for Solid. > > > Description > ------- > > Keep watching service until last inhibition goes > > > Also contains the commit: > > Remove inhibition with take() for efficiency > > Re-use the returned service QString rather than look it up each time. > > > Diffs > ----- > > powerdevil/daemon/powerdevilpolicyagent.cpp > d688512f0eba1c9d201c32bf5312edbe87af3c78 > > Diff: http://git.reviewboard.kde.org/r/107698/diff/ > > > Testing > ------- > > Sanity checked inhibition lifetime with python scripts. > > > Thanks, > > Oliver Henshaw > >
_______________________________________________ Kde-hardware-devel mailing list [email protected] https://mail.kde.org/mailman/listinfo/kde-hardware-devel
