mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
Fix clang-tidy modernize-loop-convert warnings in headers
This commit is contained in:
parent
451b25cfad
commit
c0e275604f
5 changed files with 16 additions and 14 deletions
|
@ -333,8 +333,8 @@ protected:
|
|||
struct BOF_Buffer {
|
||||
BOF_Buffer() : full(false), size(0) {}
|
||||
~BOF_Buffer() {
|
||||
for ( size_t i = 0; i < chunks.size(); ++i )
|
||||
delete chunks[i];
|
||||
for ( auto* chunk : chunks )
|
||||
delete chunk;
|
||||
}
|
||||
|
||||
bool full;
|
||||
|
|
|
@ -118,17 +118,17 @@ public:
|
|||
name = other.name ? util::copy_string(other.name) : nullptr;
|
||||
mode = other.mode;
|
||||
|
||||
for ( config_map::const_iterator i = other.config.begin(); i != other.config.end(); i++ )
|
||||
config.insert(std::make_pair(util::copy_string(i->first), util::copy_string(i->second)));
|
||||
for ( const auto& [k, v] : other.config )
|
||||
config.insert(std::make_pair(util::copy_string(k), util::copy_string(v)));
|
||||
}
|
||||
|
||||
~ReaderInfo() {
|
||||
delete[] source;
|
||||
delete[] name;
|
||||
|
||||
for ( config_map::iterator i = config.begin(); i != config.end(); i++ ) {
|
||||
delete[] i->first;
|
||||
delete[] i->second;
|
||||
for ( auto [k, v] : config ) {
|
||||
delete[] k;
|
||||
delete[] v;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -106,8 +106,8 @@ public:
|
|||
rotation_base = other.rotation_base;
|
||||
network_time = other.network_time;
|
||||
|
||||
for ( config_map::const_iterator i = other.config.begin(); i != other.config.end(); i++ )
|
||||
config.insert(std::make_pair(util::copy_string(i->first), util::copy_string(i->second)));
|
||||
for ( const auto& [k, v] : other.config )
|
||||
config.insert(std::make_pair(util::copy_string(k), util::copy_string(v)));
|
||||
|
||||
filter_name = other.filter_name;
|
||||
}
|
||||
|
@ -116,9 +116,9 @@ public:
|
|||
delete[] path;
|
||||
delete[] post_proc_func;
|
||||
|
||||
for ( config_map::iterator i = config.begin(); i != config.end(); i++ ) {
|
||||
delete[] i->first;
|
||||
delete[] i->second;
|
||||
for ( auto [k, v] : config ) {
|
||||
delete[] k;
|
||||
delete[] v;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -196,6 +196,7 @@ inline std::vector<std::unique_lock<std::mutex>> Queue<T>::LocksForAllQueues() {
|
|||
std::vector<std::unique_lock<std::mutex>> locks;
|
||||
|
||||
try {
|
||||
// NOLINTNEXTLINE(modernize-loop-convert)
|
||||
for ( int i = 0; i < NUM_QUEUES; i++ )
|
||||
locks.emplace_back(std::unique_lock<std::mutex>(mutex[i]));
|
||||
}
|
||||
|
@ -216,6 +217,7 @@ inline uint64_t Queue<T>::Size() {
|
|||
|
||||
uint64_t size = 0;
|
||||
|
||||
// NOLINTNEXTLINE(modernize-loop-convert)
|
||||
for ( int i = 0; i < NUM_QUEUES; i++ )
|
||||
size += messages[i].size();
|
||||
|
||||
|
|
|
@ -281,8 +281,8 @@ public:
|
|||
ScriptTarget(const std::string& name, const std::string& pattern) : Target(name, pattern), script_deps() {}
|
||||
|
||||
~ScriptTarget() override {
|
||||
for ( size_t i = 0; i < pkg_deps.size(); ++i )
|
||||
delete pkg_deps[i];
|
||||
for ( auto* pkg : pkg_deps )
|
||||
delete pkg;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue