Skip to content

Commit 7acfd4c

Browse files
committed
Bug#37471922: Auto-fix clang-tidy warnings [60/n] [noclose]
Generate fixes for a number of warnings that clang-tidy can fix automatically. This commit fixes the warning 'readability-container-contains'. Change example: - if (config.count(section_id) == 0) { + if (!config.contains(section_id)) { Change-Id: I240934c144bc5c6f729bdfc6fea14ffc6a748338
1 parent 3261fe9 commit 7acfd4c

File tree

5 files changed

+5
-5
lines changed

5 files changed

+5
-5
lines changed

plugin/group_replication/libmysqlgcs/src/bindings/xcom/gcs_xcom_communication_interface.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ int Gcs_xcom_communication::add_event_listener(
184184
int handler_key = 0;
185185
do {
186186
handler_key = rand();
187-
} while (event_listeners.count(handler_key) != 0);
187+
} while (event_listeners.contains(handler_key));
188188

189189
event_listeners.emplace(handler_key, event_listener);
190190

plugin/group_replication/libmysqlgcs/src/bindings/xcom/gcs_xcom_control_interface.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -924,7 +924,7 @@ int Gcs_xcom_control::add_event_listener(
924924
int handler_key = 0;
925925
do {
926926
handler_key = rand();
927-
} while (event_listeners.count(handler_key) != 0);
927+
} while (event_listeners.contains(handler_key));
928928

929929
event_listeners.emplace(handler_key, event_listener);
930930

router/src/harness/src/dynamic_config.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ void DynamicConfig::set_option(const ValueType value_type,
133133
const OptionValue &value) {
134134
auto &config = get_config(value_type);
135135

136-
if (config.count(section_id) == 0) {
136+
if (!config.contains(section_id)) {
137137
SectionOptions section_options;
138138
section_options[std::string(option_name)] = value;
139139
config[section_id].options = std::move(section_options);

sql/gen_keyword_list.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ int main(int argc, const char *argv[]) {
159159

160160
if (!isalpha(sym->name[0])) continue; // Operator.
161161

162-
bool is_reserved = keyword_tokens.count(sym->tok) == 0;
162+
bool is_reserved = !keyword_tokens.contains(sym->tok);
163163
if (!words.insert(std::make_pair(sym->name, is_reserved)).second) {
164164
fprintf(stderr,
165165
"This should not happen: \"%s\" has duplicates."

storage/ndb/src/common/mgmcommon/DnsCache.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ bool LocalDnsCache::getCachedOrResolveAddress(ndb_sockaddr *result,
5454

5555
int LocalDnsCache::getAddress(ndb_sockaddr *result_address,
5656
const char *hostname) {
57-
if (m_failed_lookups.count(hostname) != 0) {
57+
if (m_failed_lookups.contains(hostname)) {
5858
// Lookup failed earlier, same result now
5959
return -1;
6060
}

0 commit comments

Comments
 (0)