D6674: use an initializer list instead of calling insert a million times

Kevin Funk noreply at phabricator.kde.org
Thu Jul 13 10:29:59 UTC 2017


kfunk accepted this revision.
kfunk added inline comments.
This revision is now accepted and ready to land.

INLINE COMMENTS

> kaboutdata.cpp:352
>      // Use normalized keywords, by the algorithm below.
> -    static QHash<QByteArray, KAboutLicense::LicenseKey> ldict;
> -    if (ldict.isEmpty()) {
> -        ldict.insert("gpl", KAboutLicense::GPL);
> -        ldict.insert("gplv2", KAboutLicense::GPL_V2);
> -        ldict.insert("gplv2+", KAboutLicense::GPL_V2);
> -        ldict.insert("lgpl", KAboutLicense::LGPL);
> -        ldict.insert("lgplv2", KAboutLicense::LGPL_V2);
> -        ldict.insert("lgplv2+", KAboutLicense::LGPL_V2);
> -        ldict.insert("bsd", KAboutLicense::BSDL);
> -        ldict.insert("artistic", KAboutLicense::Artistic);
> -        ldict.insert("qpl", KAboutLicense::QPL);
> -        ldict.insert("qplv1", KAboutLicense::QPL_V1_0);
> -        ldict.insert("qplv10", KAboutLicense::QPL_V1_0);
> -        ldict.insert("gplv3", KAboutLicense::GPL_V3);
> -        ldict.insert("gplv3+", KAboutLicense::GPL_V3);
> -        ldict.insert("lgplv3", KAboutLicense::LGPL_V3);
> -        ldict.insert("lgplv3+", KAboutLicense::LGPL_V3);
> -        ldict.insert("lgplv21", KAboutLicense::LGPL_V2_1);
> -        ldict.insert("lgplv21+", KAboutLicense::LGPL_V2_1);
> -    }
> +    static const QHash<QByteArray, KAboutLicense::LicenseKey> ldict {
> +        { "gpl", KAboutLicense::GPL },

While at it: `ldict` -> `licenseDict`?

REPOSITORY
  R244 KCoreAddons

BRANCH
  init-list

REVISION DETAIL
  https://phabricator.kde.org/D6674

To: sitter, mpyne, kfunk
Cc: kfunk, #frameworks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20170713/b06522e8/attachment.html>


More information about the Kde-frameworks-devel mailing list