[gnote] Use std::vector for load_modules



commit 2cb09f023ba037251d9ab2a989b50e1d35399234
Author: Aurimas Černius <aurisc4 gmail com>
Date:   Sat Apr 13 19:57:39 2019 +0300

    Use std::vector for load_modules

 src/addinmanager.cpp        | 8 +++++---
 src/addinmanager.hpp        | 2 +-
 src/sharp/modulemanager.cpp | 4 ++--
 src/sharp/modulemanager.hpp | 4 ++--
 4 files changed, 10 insertions(+), 8 deletions(-)
---
diff --git a/src/addinmanager.cpp b/src/addinmanager.cpp
index c8367a7e..3c953e48 100644
--- a/src/addinmanager.cpp
+++ b/src/addinmanager.cpp
@@ -227,8 +227,9 @@ namespace {
     }
   }
 
-  void AddinManager::get_enabled_addins(std::list<Glib::ustring> & addins) const
+  std::vector<Glib::ustring> AddinManager::get_enabled_addins() const
   {
+    std::vector<Glib::ustring> addins;
     bool global_addins_prefs_loaded = true;
     Glib::KeyFile global_addins_prefs;
     try {
@@ -248,6 +249,8 @@ namespace {
           addins.push_back(iter->second.addin_module());
       }
     }
+
+    return addins;
   }
 
   void AddinManager::initialize_sharp_addins()
@@ -281,8 +284,7 @@ namespace {
     Glib::ustring local_path = m_gnote_conf_dir + "/addins";
 
     load_addin_infos(global_path, local_path);
-    std::list<Glib::ustring> enabled_addins;
-    get_enabled_addins(enabled_addins);
+    std::vector<Glib::ustring> enabled_addins = get_enabled_addins();
     m_module_manager.load_modules(enabled_addins);
 
     const sharp::ModuleMap & modules = m_module_manager.get_modules();
diff --git a/src/addinmanager.hpp b/src/addinmanager.hpp
index 7ad13c24..54b9ba34 100644
--- a/src/addinmanager.hpp
+++ b/src/addinmanager.hpp
@@ -89,7 +89,7 @@ private:
   void load_addin_infos(const Glib::ustring & global_path, const Glib::ustring & local_path);
   void load_addin_infos(const Glib::ustring & path);
   void load_note_addin(const Glib::ustring & id, sharp::IfaceFactoryBase *const f);
-  void get_enabled_addins(std::list<Glib::ustring> & addins) const;
+  std::vector<Glib::ustring> get_enabled_addins() const;
   void initialize_sharp_addins();
   void add_module_addins(const Glib::ustring & mod_id, sharp::DynamicModule * dmod);
   AddinInfo get_info_for_module(const Glib::ustring & module) const;
diff --git a/src/sharp/modulemanager.cpp b/src/sharp/modulemanager.cpp
index b3ed4c50..1e495948 100644
--- a/src/sharp/modulemanager.cpp
+++ b/src/sharp/modulemanager.cpp
@@ -1,7 +1,7 @@
 /*
  * gnote
  *
- * Copyright (C) 2013,2017 Aurimas Cernius
+ * Copyright (C) 2013,2017,2019 Aurimas Cernius
  * Copyright (C) 2009 Hubert Figuiere
  * 
  * Permission is hereby granted, free of charge, to any person obtaining a
@@ -81,7 +81,7 @@ namespace sharp {
     return dmod;
   }
 
-  void ModuleManager::load_modules(const std::list<Glib::ustring> & modules)
+  void ModuleManager::load_modules(const std::vector<Glib::ustring> & modules)
   {
     for(auto module : modules) {
       load_module(module);
diff --git a/src/sharp/modulemanager.hpp b/src/sharp/modulemanager.hpp
index 1ecdfa0a..e1793a31 100644
--- a/src/sharp/modulemanager.hpp
+++ b/src/sharp/modulemanager.hpp
@@ -1,7 +1,7 @@
 /*
  * gnote
  *
- * Copyright (C) 2013,2017 Aurimas Cernius
+ * Copyright (C) 2013,2017,2019 Aurimas Cernius
  * Copyright (C) 2009 Hubert Figuiere
  * 
  * Permission is hereby granted, free of charge, to any person obtaining a
@@ -44,7 +44,7 @@ public:
   ~ModuleManager();
 
   DynamicModule *load_module(const Glib::ustring & module);
-  void load_modules(const std::list<Glib::ustring> & modules);
+  void load_modules(const std::vector<Glib::ustring> & modules);
   
   const ModuleMap & get_modules() const
     { return m_modules; }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]