aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorlevlam <levlam@telegram.org>2023-06-10 23:14:03 +0300
committerlevlam <levlam@telegram.org>2023-06-10 23:14:03 +0300
commite3256e7b4c098a8bfc573d6c4a0d5f2965a99e13 (patch)
treeb3de1b5f60323a11d7bade4554f3cc8230b45597
parent8096cf04390561f23ec34bd4266b096362375043 (diff)
Use td::append if possible.
-rw-r--r--td/telegram/PollManager.cpp2
-rw-r--r--td/telegram/files/FileManager.cpp2
-rw-r--r--tdactor/td/actor/impl/Scheduler.cpp5
-rw-r--r--tdutils/td/utils/Hints.cpp2
4 files changed, 5 insertions, 6 deletions
diff --git a/td/telegram/PollManager.cpp b/td/telegram/PollManager.cpp
index c1cece5bd..a2b170de6 100644
--- a/td/telegram/PollManager.cpp
+++ b/td/telegram/PollManager.cpp
@@ -1157,7 +1157,7 @@ void PollManager::on_get_poll_voters(PollId poll_id, int32 option_id, string off
LOG(ERROR) << "Receive " << user_id << " as voter in " << poll_id;
}
}
- voters.voter_user_ids_.insert(voters.voter_user_ids_.end(), user_ids.begin(), user_ids.end());
+ append(voters.voter_user_ids_, user_ids);
if (static_cast<int32>(user_ids.size()) > limit) {
user_ids.resize(limit);
}
diff --git a/td/telegram/files/FileManager.cpp b/td/telegram/files/FileManager.cpp
index 31220c612..864fb4da4 100644
--- a/td/telegram/files/FileManager.cpp
+++ b/td/telegram/files/FileManager.cpp
@@ -1777,7 +1777,7 @@ Status FileManager::merge(FileId x_file_id, FileId y_file_id, bool no_sync) {
bool send_updates_flag = false;
auto other_pmc_id = other_node->pmc_id_;
- node->file_ids_.insert(node->file_ids_.end(), other_node->file_ids_.begin(), other_node->file_ids_.end());
+ append(node->file_ids_, other_node->file_ids_);
for (auto file_id : other_node->file_ids_) {
auto file_id_info = get_file_id_info(file_id);
diff --git a/tdactor/td/actor/impl/Scheduler.cpp b/tdactor/td/actor/impl/Scheduler.cpp
index 64a1e1423..9eac05cff 100644
--- a/tdactor/td/actor/impl/Scheduler.cpp
+++ b/tdactor/td/actor/impl/Scheduler.cpp
@@ -12,6 +12,7 @@
#include "td/actor/impl/Event.h"
#include "td/actor/impl/EventFull.h"
+#include "td/utils/algorithm.h"
#include "td/utils/common.h"
#include "td/utils/ExitGuard.h"
#include "td/utils/format.h"
@@ -26,7 +27,6 @@
#include "td/utils/Time.h"
#include <functional>
-#include <iterator>
#include <memory>
#include <utility>
@@ -314,8 +314,7 @@ void Scheduler::register_migrated_actor(ActorInfo *actor_info) {
}
auto it = pending_events_.find(actor_info);
if (it != pending_events_.end()) {
- actor_info->mailbox_.insert(actor_info->mailbox_.end(), std::make_move_iterator(it->second.begin()),
- std::make_move_iterator(it->second.end()));
+ append(actor_info->mailbox_, std::move(it->second));
pending_events_.erase(it);
}
if (actor_info->mailbox_.empty()) {
diff --git a/tdutils/td/utils/Hints.cpp b/tdutils/td/utils/Hints.cpp
index e6ddc69e3..8af4d9fd4 100644
--- a/tdutils/td/utils/Hints.cpp
+++ b/tdutils/td/utils/Hints.cpp
@@ -115,7 +115,7 @@ void Hints::add_search_results(vector<KeyT> &results, const string &word,
LOG(DEBUG) << "Search for word " << word;
auto it = word_to_keys.lower_bound(word);
while (it != word_to_keys.end() && begins_with(it->first, word)) {
- results.insert(results.end(), it->second.begin(), it->second.end());
+ append(results, it->second);
++it;
}
}