From: Arvin Schnell Date: Wed, 19 Apr 2023 07:35:18 +0000 (+0200) Subject: - prefer vector over list X-Git-Tag: v0.10.5~22^2~2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b2a3f55c57b97780e104ecf8e6f27c4e97b2362a;p=thirdparty%2Fsnapper.git - prefer vector over list --- diff --git a/snapper/Snapshot.cc b/snapper/Snapshot.cc index 970ee1eb..9c75233e 100644 --- a/snapper/Snapshot.cc +++ b/snapper/Snapshot.cc @@ -300,8 +300,8 @@ namespace snapper getChildValue(node, "cleanup", snapshot.cleanup); - const list l = getChildNodes(node, "userdata"); - for (list::const_iterator it2 = l.begin(); it2 != l.end(); ++it2) + const vector l = getChildNodes(node, "userdata"); + for (vector::const_iterator it2 = l.begin(); it2 != l.end(); ++it2) { string key, value; getChildValue(*it2, "key", key); diff --git a/snapper/XmlFile.cc b/snapper/XmlFile.cc index ff621d2d..f0cace8f 100644 --- a/snapper/XmlFile.cc +++ b/snapper/XmlFile.cc @@ -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 +#include #include #include "snapper/Exception.h" @@ -128,10 +128,10 @@ namespace snapper } - list + vector getChildNodes(const xmlNode* node, const char* name) { - list ret; + vector ret; if (node != NULL) node = node->children; diff --git a/snapper/XmlFile.h b/snapper/XmlFile.h index c80b7ca3..10801b75 100644 --- a/snapper/XmlFile.h +++ b/snapper/XmlFile.h @@ -1,5 +1,6 @@ /* * Copyright (c) [2010-2012] Novell, Inc. + * Copyright (c) 2023 SUSE LLC * * All Rights Reserved. * @@ -26,7 +27,7 @@ #include #include -#include +#include #include #include @@ -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 getChildNodes(const xmlNode* node, const char* name); + vector getChildNodes(const xmlNode* node, const char* name); bool getValue(const xmlNode* node, string& value); @@ -109,9 +110,9 @@ namespace snapper } template - void setChildValue(xmlNode* node, const char* name, const list& values) + void setChildValue(xmlNode* node, const char* name, const vector& values) { - for (typename list::const_iterator it = values.begin(); it != values.end(); ++it) + for (typename vector::const_iterator it = values.begin(); it != values.end(); ++it) setChildValue(node, name, *it); } diff --git a/zypp-plugin/solvable-matcher.cc b/zypp-plugin/solvable-matcher.cc index b02647cf..87cc4a7f 100644 --- a/zypp-plugin/solvable-matcher.cc +++ b/zypp-plugin/solvable-matcher.cc @@ -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 solvables_l = getChildNodes(solvables_n, "solvable"); + const vector solvables_l = getChildNodes(solvables_n, "solvable"); for (const xmlNode* node : solvables_l) { string pattern;