GeezerVison is showing github.com — src: use C++20 `contains()` method · nodejs/node@133d410
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: src/inspector/io_agent.cc +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -27,7 +27,7 @@ DispatchResponse IoAgent::read(const String& in_handle, |
27 | 27 | if (in_offset.has_value()) { |
28 | 28 | offset = *in_offset; |
29 | 29 | offset_was_specified = true; |
30 | | - } else if (offset_map_.find(url) != offset_map_.end()) { |
| 30 | + } else if (offset_map_.contains(url)) { |
31 | 31 | offset = offset_map_[url]; |
32 | 32 | } |
33 | 33 | int size = 1 << 20; |
|
Collapse file
Copy file name to clipboardExpand all lines: src/inspector_profiler.h +1-3Lines changed: 1 addition & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -65,9 +65,7 @@ class V8ProfilerConnection { |
65 | 65 | simdjson::ondemand::object* result); |
66 | 66 | virtual void WriteProfile(simdjson::ondemand::object* result); |
67 | 67 |
|
68 | | - bool HasProfileId(uint64_t id) const { |
69 | | - return profile_ids_.find(id) != profile_ids_.end(); |
70 | | - } |
| 68 | + bool HasProfileId(uint64_t id) const { return profile_ids_.contains(id); } |
71 | 69 |
|
72 | 70 | void RemoveProfileId(uint64_t id) { profile_ids_.erase(id); } |
73 | 71 |
|
|
Collapse file
Copy file name to clipboardExpand all lines: src/node_blob.cc +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -534,11 +534,11 @@ void BlobBindingData::store_data_object( |
534 | 534 | } |
535 | 535 |
|
536 | 536 | void BlobBindingData::revoke_data_object(const std::string& uuid) { |
537 | | - if (data_objects_.find(uuid) == data_objects_.end()) { |
| 537 | + if (!data_objects_.contains(uuid)) { |
538 | 538 | return; |
539 | 539 | } |
540 | 540 | data_objects_.erase(uuid); |
541 | | - CHECK_EQ(data_objects_.find(uuid), data_objects_.end()); |
| 541 | + CHECK(!data_objects_.contains(uuid)); |
542 | 542 | } |
543 | 543 |
|
544 | 544 | BlobBindingData::StoredDataObject BlobBindingData::get_data_object( |
|
Collapse file
Copy file name to clipboardExpand all lines: src/node_builtins.cc +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -307,7 +307,7 @@ MaybeLocal<Function> BuiltinLoader::LookupAndCompileInternal( |
307 | 307 | if (should_eager_compile_) { |
308 | 308 | options = ScriptCompiler::kEagerCompile; |
309 | 309 | } else if (!to_eager_compile_.empty()) { |
310 | | - if (to_eager_compile_.find(id) != to_eager_compile_.end()) { |
| 310 | + if (to_eager_compile_.contains(id)) { |
311 | 311 | options = ScriptCompiler::kEagerCompile; |
312 | 312 | } |
313 | 313 | } |
|
Collapse file
Copy file name to clipboardExpand all lines: src/node_env_var.cc +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -258,7 +258,7 @@ void MapKVStore::Set(Isolate* isolate, Local<String> key, Local<String> value) { |
258 | 258 |
|
259 | 259 | int32_t MapKVStore::Query(const char* key) const { |
260 | 260 | Mutex::ScopedLock lock(mutex_); |
261 | | - return map_.find(key) == map_.end() ? -1 : 0; |
| 261 | + return map_.contains(key) ? 0 : -1; |
262 | 262 | } |
263 | 263 |
|
264 | 264 | int32_t MapKVStore::Query(Isolate* isolate, Local<String> key) const { |
|
Collapse file
Copy file name to clipboardExpand all lines: src/node_messaging.cc +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -1508,7 +1508,7 @@ Maybe<bool> SiblingGroup::Dispatch( |
1508 | 1508 | RwLock::ScopedReadLock lock(group_mutex_); |
1509 | 1509 |
|
1510 | 1510 | // The source MessagePortData is not part of this group. |
1511 | | - if (ports_.find(source) == ports_.end()) { |
| 1511 | + if (!ports_.contains(source)) { |
1512 | 1512 | if (error != nullptr) |
1513 | 1513 | *error = "Source MessagePort is not entangled with this group."; |
1514 | 1514 | return Nothing<bool>(); |
|
Collapse file
Copy file name to clipboardExpand all lines: src/signal_wrap.cc +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -170,7 +170,7 @@ void DecreaseSignalHandlerCount(int signum) { |
170 | 170 |
|
171 | 171 | bool HasSignalJSHandler(int signum) { |
172 | 172 | Mutex::ScopedLock lock(handled_signals_mutex); |
173 | | - return handled_signals.find(signum) != handled_signals.end(); |
| 173 | + return handled_signals.contains(signum); |
174 | 174 | } |
175 | 175 | } // namespace node |
176 | 176 |
|
|