Better iterators increment.

GitOrigin-RevId: 5da2e57210ce62f78ab938005a4683d2c1e26547
This commit is contained in:
levlam 2018-04-23 01:14:49 +03:00
parent 8cb1a682cc
commit f758d592dd
10 changed files with 17 additions and 17 deletions

View File

@ -782,9 +782,9 @@ class QueueBenchmark : public td::Benchmark {
std::fprintf(stderr, "Too big queries_n\n");
std::exit(0);
}
for (int it = 0; it < queries_n; it++) {
for (int query = 0; query < queries_n; query++) {
for (int i = 0; i < connections_n; i++) {
server.put((static_cast<td::int64>(i) << 24) + it);
server.put((static_cast<td::int64>(i) << 24) + query);
}
for (int i = 0; i < connections_n; i++) {
qvalue_t value = client.get();

View File

@ -25324,7 +25324,7 @@ void MessagesManager::suffix_load_query_ready(DialogId dialog_id) {
auto *m = get_message_force(d, d->suffix_load_first_message_id_);
auto ready_it = std::partition(d->suffix_load_queries_.begin(), d->suffix_load_queries_.end(),
[&](auto &value) { return !(d->suffix_load_done_ || value.second(m)); });
for (auto it = ready_it; it != d->suffix_load_queries_.end(); it++) {
for (auto it = ready_it; it != d->suffix_load_queries_.end(); ++it) {
it->first.set_value(Unit());
}
d->suffix_load_queries_.erase(ready_it, d->suffix_load_queries_.end());

View File

@ -545,7 +545,7 @@ void SecretChatsManager::flush_pending_chat_updates() {
auto it = pending_chat_updates_.begin();
while (it != pending_chat_updates_.end() && (it->first.is_in_past() || is_online_)) {
do_update_chat(std::move(it->second));
it++;
++it;
}
if (it != pending_chat_updates_.end()) {
set_timeout_at(it->first.at());

View File

@ -391,7 +391,7 @@ Result<FileLoader::CheckInfo> FileDownloader::check_loop(int64 checked_prefix_si
search_info.offset = checked_prefix_size;
auto it = hash_info_.upper_bound(search_info);
if (it != hash_info_.begin()) {
it--;
--it;
}
if (it != hash_info_.end() && it->offset <= checked_prefix_size &&
it->offset + narrow_cast<int64>(it->size) > checked_prefix_size) {

View File

@ -102,7 +102,7 @@ void FileStats::apply_dialog_limit(int32 limit) {
bool other_flag = false;
for (auto it = stat_by_owner_dialog_id.begin(); it != stat_by_owner_dialog_id.end();) {
if (all_dialogs.count(it->first)) {
it++;
++it;
} else {
for (size_t i = 0; i < file_type_size; i++) {
other_stats[i].size += it->second[i].size;

View File

@ -329,7 +329,7 @@ void ConnectionCreator::client_loop(ClientInfo &client) {
VLOG(connections) << "Send to promise " << tag("connection", client.ready_connections.back().first.get());
it->set_value(std::move(client.ready_connections.back().first));
client.ready_connections.pop_back();
it++;
++it;
}
client.queries.erase(begin, it);
}

View File

@ -421,7 +421,7 @@ void Session::on_closed(Status status) {
it = sent_queries_.erase(it);
} else {
mark_as_unknown(it->first, &it->second);
it++;
++it;
}
} else {
++it;

View File

@ -73,13 +73,13 @@ uint64 pq_factorize(uint64 pq) {
return 1;
}
uint64 g = 0;
for (int i = 0, it = 0; i < 3 || it < 1000; i++) {
for (int i = 0, iter = 0; i < 3 || iter < 1000; i++) {
uint64 q = Random::fast(17, 32) % (pq - 1);
uint64 x = Random::fast_uint64() % (pq - 1) + 1;
uint64 y = x;
int lim = 1 << (min(5, i) + 18);
for (int j = 1; j < lim; j++) {
it++;
iter++;
uint64 a = x;
uint64 b = x;
uint64 c = q;
@ -168,14 +168,14 @@ static int pq_factorize_big(Slice pq_str, string *p_str, string *q_str) {
BigNum pq = BigNum::from_binary(pq_str);
bool found = false;
for (int i = 0, it = 0; !found && (i < 3 || it < 1000); i++) {
for (int i = 0, iter = 0; !found && (i < 3 || iter < 1000); i++) {
int32 t = Random::fast(17, 32);
a.set_value(Random::fast_uint32());
b = a;
int32 lim = 1 << (i + 23);
for (int j = 1; j < lim; j++) {
it++;
iter++;
BigNum::mod_mul(a, a, a, pq, context);
a += t;
if (BigNum::compare(a, pq) >= 0) {

View File

@ -58,7 +58,7 @@ void Select::unsubscribe(const Fd &fd) {
fds_.pop_back();
break;
} else {
it++;
++it;
}
}
}

View File

@ -332,9 +332,9 @@ Result<string> mkdtemp(CSlice dir, Slice prefix) {
}
dir_pattern.append(prefix.begin(), prefix.size());
for (auto it = 0; it < 20; it++) {
for (auto iter = 0; iter < 20; iter++) {
auto path = dir_pattern;
for (int i = 0; i < 6 + it / 5; i++) {
for (int i = 0; i < 6 + iter / 5; i++) {
path += static_cast<char>(Random::fast('a', 'z'));
}
auto status = mkdir(path);
@ -364,9 +364,9 @@ Result<std::pair<FileFd, string>> mkstemp(CSlice dir) {
}
file_pattern += "tmp";
for (auto it = 0; it < 20; it++) {
for (auto iter = 0; iter < 20; iter++) {
auto path = file_pattern;
for (int i = 0; i < 6 + it / 5; i++) {
for (int i = 0; i < 6 + iter / 5; i++) {
path += static_cast<char>(Random::fast('a', 'z'));
}
auto r_file = FileFd::open(path, FileFd::Write | FileFd::Read | FileFd::CreateNew);