From: Arvin Schnell Date: Wed, 29 Mar 2023 07:20:02 +0000 (+0200) Subject: - prefer vector over list X-Git-Tag: v0.10.5~27^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F798%2Fhead;p=thirdparty%2Fsnapper.git - prefer vector over list --- diff --git a/dbus/DBusMessage.h b/dbus/DBusMessage.h index ba105652..5b0abfb7 100644 --- a/dbus/DBusMessage.h +++ b/dbus/DBusMessage.h @@ -30,7 +30,6 @@ #include #include #include -#include #include #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 - Unmarshaller& operator>>(Unmarshaller& unmarshaller, list& 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::signature) - throw MarshallingException(); - - Type tmp; - unmarshaller >> tmp; - data.push_back(tmp); - } - - unmarshaller.close_recurse(); - - return unmarshaller; - } - - - template - Marshaller& operator<<(Marshaller& marshaller, const list& data) - { - marshaller.open_array(TypeInfo::signature); - - for (typename list::const_iterator it = data.begin(); it != data.end(); ++it) - { - marshaller << *it; - } - - marshaller.close_array(); - - return marshaller; - } - } diff --git a/server/Client.cc b/server/Client.cc index 5adcea73..c4549f41 100644 --- a/server/Client.cc +++ b/server/Client.cc @@ -388,6 +388,8 @@ Client::introspect(DBus::Connection& conn, DBus::Message& msg) " \n" "\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& nums) + const vector& 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 nums; + vector 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 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::const_iterator it2 = nums.begin(); it2 != nums.end(); ++it2) + for (vector::const_iterator it2 = nums.begin(); it2 != nums.end(); ++it2) { check_snapshot_in_use(*it1, *it2); diff --git a/server/Client.h b/server/Client.h index 398756ae..a2d428bf 100644 --- a/server/Client.h +++ b/server/Client.h @@ -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& nums); + const vector& nums); void list_configs(DBus::Connection& conn, DBus::Message& msg); void get_config(DBus::Connection& conn, DBus::Message& msg);