Skip to content

Commit 9c9c1bb

Browse files
committed
Minor improvements.
1 parent 7097b2b commit 9c9c1bb

4 files changed

Lines changed: 9 additions & 7 deletions

File tree

‎td/telegram/net/DcOptionsSet.cpp‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ vector<DcOptionsSet::ConnectionInfo> DcOptionsSet::find_all_connections(DcId dc_
110110
if (!static_options.empty()) {
111111
options = std::move(static_options);
112112
} else {
113-
bool have_ipv4 = td::any_of(options, [](const auto &v) { return !v.option->is_ipv6(); });
113+
bool have_ipv4 = any_of(options, [](const auto &v) { return !v.option->is_ipv6(); });
114114
if (have_ipv4) {
115115
td::remove_if(options, [](auto &v) { return v.option->is_ipv6(); });
116116
}
@@ -122,13 +122,13 @@ vector<DcOptionsSet::ConnectionInfo> DcOptionsSet::find_all_connections(DcId dc_
122122
}
123123

124124
if (prefer_ipv6) {
125-
bool have_ipv6 = td::any_of(options, [](const auto &v) { return v.option->is_ipv6(); });
125+
bool have_ipv6 = any_of(options, [](const auto &v) { return v.option->is_ipv6(); });
126126
if (have_ipv6) {
127127
td::remove_if(options, [](auto &v) { return !v.option->is_ipv6(); });
128128
}
129129
}
130130

131-
bool have_media_only = td::any_of(options, [](const auto &v) { return v.option->is_media_only(); });
131+
bool have_media_only = any_of(options, [](const auto &v) { return v.option->is_media_only(); });
132132
if (have_media_only) {
133133
td::remove_if(options, [](auto &v) { return !v.option->is_media_only(); });
134134
}

‎tddb/td/db/BinlogKeyValue.h‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include "td/utils/buffer.h"
1616
#include "td/utils/common.h"
1717
#include "td/utils/FlatHashMap.h"
18+
#include "td/utils/HashTableUtils.h"
1819
#include "td/utils/logging.h"
1920
#include "td/utils/misc.h"
2021
#include "td/utils/port/RwMutex.h"
@@ -219,9 +220,9 @@ class BinlogKeyValue final : public KeyValueSyncInterface {
219220
binlog_->lazy_sync(std::move(promise));
220221
}
221222

222-
std::unordered_map<string, string> prefix_get(Slice prefix) final {
223+
std::unordered_map<string, string, Hash<string>> prefix_get(Slice prefix) final {
223224
auto lock = rw_mutex_.lock_write().move_as_ok();
224-
std::unordered_map<string, string> res;
225+
std::unordered_map<string, string, Hash<string>> res;
225226
for (const auto &kv : map_) {
226227
if (begins_with(kv.first, prefix)) {
227228
res.emplace(kv.first.substr(prefix.size()), kv.second.first);

‎tddb/td/db/KeyValueSyncInterface.h‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
#include "td/utils/common.h"
1010
#include "td/utils/FlatHashMap.h"
11+
#include "td/utils/HashTableUtils.h"
1112
#include "td/utils/Promise.h"
1213
#include "td/utils/Slice.h"
1314

@@ -34,7 +35,7 @@ class KeyValueSyncInterface {
3435

3536
virtual string get(const string &key) = 0;
3637

37-
virtual std::unordered_map<string, string> prefix_get(Slice prefix) = 0;
38+
virtual std::unordered_map<string, string, Hash<string>> prefix_get(Slice prefix) = 0;
3839

3940
virtual FlatHashMap<string, string> get_all() = 0;
4041

‎tdutils/td/utils/FloodControlStrict.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
namespace td {
1414

15-
// More strict implementaions of flood control than FloodControlFast.
15+
// More strict implementations of flood control than FloodControlFast.
1616
// Should be just fine for small counters.
1717
class FloodControlStrict {
1818
public:

0 commit comments

Comments
 (0)