Improve some variable names.

GitOrigin-RevId: b399b6fc1150aced96a41a75797d88e2df627415
This commit is contained in:
levlam 2020-06-24 14:33:20 +03:00
parent fd6423dedf
commit f6b4ced7bb
3 changed files with 16 additions and 15 deletions

View File

@ -264,11 +264,11 @@ static ActorOwn<> get_simple_config_dns(Slice address, Slice host, Promise<Simpl
TRY_RESULT(answer, get_json_object_field(answer_object, "Answer", JsonValue::Type::Array, false));
auto &answer_array = answer.get_array();
vector<string> parts;
for (auto &v : answer_array) {
if (v.type() != JsonValue::Type::Object) {
for (auto &answer_part : answer_array) {
if (answer_part.type() != JsonValue::Type::Object) {
return Status::Error("Expected JSON object");
}
auto &data_object = v.get_object();
auto &data_object = answer_part.get_object();
TRY_RESULT(part, get_json_object_string_field(data_object, "data", false));
parts.push_back(std::move(part));
}
@ -863,10 +863,11 @@ class ConfigRecoverer : public Actor {
}
void update_dc_options() {
auto v = simple_config_.dc_options;
v.insert(v.begin(), dc_options_update_.dc_options.begin(), dc_options_update_.dc_options.end());
if (v != dc_options_.dc_options) {
dc_options_.dc_options = std::move(v);
auto new_dc_options = simple_config_.dc_options;
new_dc_options.insert(new_dc_options.begin(), dc_options_update_.dc_options.begin(),
dc_options_update_.dc_options.end());
if (new_dc_options != dc_options_.dc_options) {
dc_options_.dc_options = std::move(new_dc_options);
dc_options_i_ = 0;
dc_options_at_ = Time::now();
}

View File

@ -1442,10 +1442,9 @@ void UpdatesManager::set_seq_gap_timeout(double timeout) {
}
void UpdatesManager::on_pending_update(tl_object_ptr<telegram_api::Update> update, int32 seq, const char *source) {
vector<tl_object_ptr<telegram_api::Update>> v;
v.push_back(std::move(update));
on_pending_updates(std::move(v), seq, seq, 0, source); // TODO can be optimized
vector<tl_object_ptr<telegram_api::Update>> updates;
updates.push_back(std::move(update));
on_pending_updates(std::move(updates), seq, seq, 0, source);
}
void UpdatesManager::on_update(tl_object_ptr<telegram_api::updateNewMessage> update, bool force_apply) {

View File

@ -68,13 +68,14 @@ static void dump_memory_usage() {
if (is_memprof_on()) {
LOG(WARNING) << "Memory dump:";
clear_thread_locals();
std::vector<AllocInfo> v;
dump_alloc([&](const AllocInfo &info) { v.push_back(info); });
std::sort(v.begin(), v.end(), [](const AllocInfo &a, const AllocInfo &b) { return a.size > b.size; });
std::vector<AllocInfo> alloc_info;
dump_alloc([&](const AllocInfo &info) { alloc_info.push_back(info); });
std::sort(alloc_info.begin(), alloc_info.end(),
[](const AllocInfo &lhs, const AllocInfo &rhs) { return lhs.size > rhs.size; });
size_t total_size = 0;
size_t other_size = 0;
int cnt = 0;
for (auto &info : v) {
for (auto &info : alloc_info) {
if (cnt++ < 50) {
LOG(WARNING) << format::as_size(info.size) << format::as_array(info.backtrace);
} else {