]> git.ipfire.org Git - thirdparty/snapper.git/commitdiff
- prefer vector over list 798/head
authorArvin Schnell <aschnell@suse.de>
Wed, 29 Mar 2023 07:20:02 +0000 (09:20 +0200)
committerArvin Schnell <aschnell@suse.de>
Wed, 29 Mar 2023 07:20:02 +0000 (09:20 +0200)
dbus/DBusMessage.h
server/Client.cc
server/Client.h

index ba1056520b1c47f1de62407a0c6798c7a821380c..5b0abfb7a9af64162e707978cd131cfac74225d8 100644 (file)
@@ -30,7 +30,6 @@
 #include <ctime>
 #include <string>
 #include <vector>
-#include <list>
 #include <map>
 
 #include "snapper/Exception.h"
@@ -40,7 +39,6 @@ namespace DBus
 {
     using std::string;
     using std::vector;
-    using std::list;
     using std::map;
 
 
@@ -288,46 +286,6 @@ namespace DBus
        return marshaller;
     }
 
-
-    template <typename Type>
-    Unmarshaller& operator>>(Unmarshaller& unmarshaller, list<Type>& data)
-    {
-       if (unmarshaller.get_type() != DBUS_TYPE_ARRAY)
-           throw MarshallingException();
-
-       unmarshaller.open_recurse();
-
-       while (unmarshaller.get_type() != DBUS_TYPE_INVALID)
-       {
-           if (unmarshaller.get_signature() != TypeInfo<Type>::signature)
-               throw MarshallingException();
-
-           Type tmp;
-           unmarshaller >> tmp;
-           data.push_back(tmp);
-       }
-
-       unmarshaller.close_recurse();
-
-       return unmarshaller;
-    }
-
-
-    template <typename Type>
-    Marshaller& operator<<(Marshaller& marshaller, const list<Type>& data)
-    {
-       marshaller.open_array(TypeInfo<Type>::signature);
-
-       for (typename list<Type>::const_iterator it = data.begin(); it != data.end(); ++it)
-       {
-           marshaller << *it;
-       }
-
-       marshaller.close_array();
-
-       return marshaller;
-    }
-
 }
 
 
index 5adcea7327977ee79f401a52b7a56e1b4fa6b9d0..c4549f417e687d79454c3442cd8932fe88b8fb48 100644 (file)
@@ -388,6 +388,8 @@ Client::introspect(DBus::Connection& conn, DBus::Message& msg)
        "  </interface>\n"
        "</node>\n";
 
+    y2deb("Introspect");
+
     DBus::MessageMethodReturn reply(msg);
 
     DBus::Marshaller marshaller(reply);
@@ -566,7 +568,7 @@ Client::signal_snapshot_modified(DBus::Connection& conn, const string& config_na
 
 void
 Client::signal_snapshots_deleted(DBus::Connection& conn, const string& config_name,
-                                const list<dbus_uint32_t>& nums)
+                                const vector<dbus_uint32_t>& nums)
 {
     DBus::MessageSignal msg(PATH, INTERFACE, "SnapshotsDeleted");
 
@@ -1073,12 +1075,12 @@ void
 Client::delete_snapshots(DBus::Connection& conn, DBus::Message& msg)
 {
     string config_name;
-    list<dbus_uint32_t> nums;
+    vector<dbus_uint32_t> nums;
 
     DBus::Unmarshaller unmarshaller(msg);
     unmarshaller >> config_name >> nums;
 
-    y2deb("DeleteSnapshots config_name:" << config_name << " nums:" << nums);
+    y2mil("DeleteSnapshots config_name:" << config_name << " nums:" << nums);
 
     boost::unique_lock<boost::shared_mutex> lock(big_mutex);
 
@@ -1091,7 +1093,7 @@ Client::delete_snapshots(DBus::Connection& conn, DBus::Message& msg)
     Snapper* snapper = it1->getSnapper();
     Snapshots& snapshots = snapper->getSnapshots();
 
-    for (list<unsigned int>::const_iterator it2 = nums.begin(); it2 != nums.end(); ++it2)
+    for (vector<unsigned int>::const_iterator it2 = nums.begin(); it2 != nums.end(); ++it2)
     {
        check_snapshot_in_use(*it1, *it2);
 
index 398756ae325a40402527e7fb0dd812df91c9623d..a2d428bf171e9ebbbae8e3ca3c605aab58ec4da8 100644 (file)
@@ -83,7 +83,7 @@ public:
     void signal_snapshot_modified(DBus::Connection& conn, const string& config_name,
                                  unsigned int num);
     void signal_snapshots_deleted(DBus::Connection& conn, const string& config_name,
-                                 const list<dbus_uint32_t>& nums);
+                                 const vector<dbus_uint32_t>& nums);
 
     void list_configs(DBus::Connection& conn, DBus::Message& msg);
     void get_config(DBus::Connection& conn, DBus::Message& msg);