]> git.ipfire.org Git - thirdparty/snapper.git/commitdiff
- prefer vector over list
authorArvin Schnell <aschnell@suse.de>
Wed, 19 Apr 2023 07:35:18 +0000 (09:35 +0200)
committerArvin Schnell <aschnell@suse.de>
Wed, 19 Apr 2023 07:35:18 +0000 (09:35 +0200)
snapper/Snapshot.cc
snapper/XmlFile.cc
snapper/XmlFile.h
zypp-plugin/solvable-matcher.cc

index 970ee1ebefc1657436858738d184e183160501e5..9c75233ea5bf1b0f1a2cda2cc37d9f8f20970916 100644 (file)
@@ -300,8 +300,8 @@ namespace snapper
 
                getChildValue(node, "cleanup", snapshot.cleanup);
 
-               const list<const xmlNode*> l = getChildNodes(node, "userdata");
-               for (list<const xmlNode*>::const_iterator it2 = l.begin(); it2 != l.end(); ++it2)
+               const vector<const xmlNode*> l = getChildNodes(node, "userdata");
+               for (vector<const xmlNode*>::const_iterator it2 = l.begin(); it2 != l.end(); ++it2)
                {
                    string key, value;
                    getChildValue(*it2, "key", key);
index ff621d2d1dcf3f2ba51c6b53ba2fa75f36cd0728..f0cace8f1f19d0cb0cb64f86e9262ec199821198 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) [2010-2012] Novell, Inc.
- * Copyright (c) [2020-2022] SUSE LLC
+ * Copyright (c) [2020-2023] SUSE LLC
  *
  * All Rights Reserved.
  *
@@ -21,7 +21,7 @@
  */
 
 
-#include <string.h>
+#include <cstring>
 #include <unistd.h>
 
 #include "snapper/Exception.h"
@@ -128,10 +128,10 @@ namespace snapper
     }
 
 
-    list<const xmlNode*>
+    vector<const xmlNode*>
     getChildNodes(const xmlNode* node, const char* name)
     {
-       list<const xmlNode*> ret;
+       vector<const xmlNode*> ret;
 
        if (node != NULL)
            node = node->children;
index c80b7ca39d85aee07abdc9e43397152428344bdc..10801b75be04613f2159bb07b31b3b532204565c 100644 (file)
@@ -1,5 +1,6 @@
 /*
  * Copyright (c) [2010-2012] Novell, Inc.
+ * Copyright (c) 2023 SUSE LLC
  *
  * All Rights Reserved.
  *
@@ -26,7 +27,7 @@
 
 #include <libxml/tree.h>
 #include <string>
-#include <list>
+#include <vector>
 #include <sstream>
 #include <boost/noncopyable.hpp>
 
@@ -36,7 +37,7 @@
 namespace snapper
 {
     using std::string;
-    using std::list;
+    using std::vector;
 
 
     class XmlFile : private boost::noncopyable
@@ -71,7 +72,7 @@ namespace snapper
 
 
     const xmlNode* getChildNode(const xmlNode* node, const char* name);
-    list<const xmlNode*> getChildNodes(const xmlNode* node, const char* name);
+    vector<const xmlNode*> getChildNodes(const xmlNode* node, const char* name);
 
 
     bool getValue(const xmlNode* node, string& value);
@@ -109,9 +110,9 @@ namespace snapper
     }
 
     template<typename Type>
-    void setChildValue(xmlNode* node, const char* name, const list<Type>& values)
+    void setChildValue(xmlNode* node, const char* name, const vector<Type>& values)
     {
-       for (typename list<Type>::const_iterator it = values.begin(); it != values.end(); ++it)
+       for (typename vector<Type>::const_iterator it = values.begin(); it != values.end(); ++it)
            setChildValue(node, name, *it);
     }
 
index b02647cf1aa19d12f957b0b76bd593d362069088..87cc4a7f2333923d93eb1a89f4a8bff69e3673f1 100644 (file)
@@ -82,7 +82,7 @@ SolvableMatcher::load_config(const string& cfg_filename)
 
        const xmlNode* root = config.getRootElement();
        const xmlNode* solvables_n = getChildNode(root, "solvables");
-       const list<const xmlNode*> solvables_l = getChildNodes(solvables_n, "solvable");
+       const vector<const xmlNode*> solvables_l = getChildNodes(solvables_n, "solvable");
        for (const xmlNode* node : solvables_l)
        {
            string pattern;