diff options
author | Michael Weghorn <m.weghorn@posteo.de> | 2014-12-15 20:27:00 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-01-08 09:54:05 +0000 |
commit | bb65b09678d4b6da657f6ccc180d8ff5096e3006 (patch) | |
tree | 2a1cb5632eb3f64977411ad7f32c983f07ff22e4 /jvmfwk | |
parent | 2abbc6fa577565376910a1b8e5e8931a2202e989 (diff) |
avoid copying of vector
Change-Id: I06ce27f4fa52637bbeaa6d84fdecdf81364e15a7
Reviewed-on: https://gerrit.libreoffice.org/13489
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'jvmfwk')
-rw-r--r-- | jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx b/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx index de1d979ceb8f..a73a0072af78 100644 --- a/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx +++ b/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx @@ -456,13 +456,13 @@ javaPluginError jfw_plugin_getJavaInfosFromPath( vector<rtl::Reference<VendorBase>> vecInfosFromPath; addJavaInfosFromPath(infos, vecInfosFromPath); - vector<rtl::Reference<VendorBase> > vecVerifiedInfos; + vector<JavaInfo*> vecVerifiedInfos; - // copy JREs that meet version requirements to vecVerifiedInfos + // copy infos of JREs that meet version requirements to vecVerifiedInfos typedef vector<rtl::Reference<VendorBase> >::iterator it; for (it i= vecInfosFromPath.begin(); i != vecInfosFromPath.end(); ++i) { - const rtl::Reference<VendorBase>& cur = *i; + const rtl::Reference<VendorBase>& currentInfo = *i; typedef std::vector<pair<OUString, jfw::VersionInfo>>::const_iterator ci_pl; for (ci_pl vendorInfo = vecVendorInfos.begin(); vendorInfo != vecVendorInfos.end(); ++vendorInfo) @@ -470,10 +470,10 @@ javaPluginError jfw_plugin_getJavaInfosFromPath( const OUString& vendor = vendorInfo->first; jfw::VersionInfo versionInfo = vendorInfo->second; - if (vendor.equals(cur->getVendor())) + if (vendor.equals(currentInfo->getVendor())) { javaPluginError errorcode = checkJavaVersionRequirements( - cur, + currentInfo, versionInfo.sMinVersion, versionInfo.sMaxVersion, versionInfo.getExcludeVersions(), @@ -481,7 +481,7 @@ javaPluginError jfw_plugin_getJavaInfosFromPath( if (errorcode == JFW_PLUGIN_E_NONE) { - vecVerifiedInfos.push_back(*i); + vecVerifiedInfos.push_back(createJavaInfo(currentInfo)); } } } @@ -490,17 +490,7 @@ javaPluginError jfw_plugin_getJavaInfosFromPath( if (vecVerifiedInfos.empty()) return JFW_PLUGIN_E_NO_JRE; - // Now vecVerifiedInfos contains all those JREs which meet the version requirements - // Transfer them into the vector that is passed out. - vector<JavaInfo*> infosFromPath; - - typedef vector<rtl::Reference<VendorBase> >::const_iterator cit; - for (cit ii = vecVerifiedInfos.begin(); ii != vecVerifiedInfos.end(); ++ii) - { - infosFromPath.push_back(createJavaInfo(*ii)); - } - - javaInfosFromPath = infosFromPath; + javaInfosFromPath = vecVerifiedInfos; return JFW_PLUGIN_E_NONE; } |