[Libreoffice-commits] core.git: jvmfwk/plugins

Michael Weghorn m.weghorn at posteo.de
Thu Jan 8 01:54:32 PST 2015


 jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx |   24 +++++---------------
 1 file changed, 7 insertions(+), 17 deletions(-)

New commits:
commit bb65b09678d4b6da657f6ccc180d8ff5096e3006
Author: Michael Weghorn <m.weghorn at posteo.de>
Date:   Mon Dec 15 20:27:00 2014 +0100

    avoid copying of vector
    
    Change-Id: I06ce27f4fa52637bbeaa6d84fdecdf81364e15a7
    Reviewed-on: https://gerrit.libreoffice.org/13489
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx b/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx
index de1d979..a73a007 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;
 }


More information about the Libreoffice-commits mailing list