mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
Merge remote-tracking branch 'origin/topic/timw/lazy-allocate-id-option-handlers'
* origin/topic/timw/lazy-allocate-id-option-handlers: Move ID::type in structure to fill memory padding Use sorted forward_list instead of multimap for ID option change handlers
This commit is contained in:
commit
8aeaed69c5
4 changed files with 18 additions and 9 deletions
6
CHANGES
6
CHANGES
|
@ -1,3 +1,9 @@
|
|||
8.0.0-dev.763 | 2025-07-28 13:57:18 -0700
|
||||
|
||||
* Move ID::type in structure to fill memory padding (Tim Wojtulewicz, Corelight)
|
||||
|
||||
* Use sorted forward_list instead of multimap for ID option change handlers (Tim Wojtulewicz, Corelight)
|
||||
|
||||
8.0.0-dev.760 | 2025-07-28 13:12:47 -0700
|
||||
|
||||
* Remove intermediate cipher vectors in ssl-analyzer.pac (Tim Wojtulewicz, Corelight)
|
||||
|
|
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
|||
8.0.0-dev.760
|
||||
8.0.0-dev.763
|
||||
|
|
12
src/ID.cc
12
src/ID.cc
|
@ -576,14 +576,16 @@ void ID::UpdateValID() {
|
|||
}
|
||||
#endif
|
||||
|
||||
void ID::AddOptionHandler(FuncPtr callback, int priority) { option_handlers.emplace(priority, std::move(callback)); }
|
||||
void ID::AddOptionHandler(FuncPtr callback, int priority) {
|
||||
option_handlers.emplace_front(priority, callback);
|
||||
option_handlers.sort(
|
||||
[](const OptionHandler& left, const OptionHandler& right) { return left.first < right.first; });
|
||||
}
|
||||
|
||||
std::vector<Func*> ID::GetOptionHandlers() const {
|
||||
// multimap is sorted
|
||||
// It might be worth caching this if we expect it to be called
|
||||
// a lot...
|
||||
// It might be worth caching this if we expect it to be called a lot...
|
||||
std::vector<Func*> v;
|
||||
for ( auto& element : option_handlers )
|
||||
for ( const auto& element : option_handlers )
|
||||
v.push_back(element.second.get());
|
||||
return v;
|
||||
}
|
||||
|
|
7
src/ID.h
7
src/ID.h
|
@ -2,7 +2,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <map>
|
||||
#include <forward_list>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <unordered_set>
|
||||
|
@ -157,9 +157,9 @@ protected:
|
|||
#endif
|
||||
|
||||
const char* name;
|
||||
TypePtr type;
|
||||
IDScope scope;
|
||||
bool is_export;
|
||||
TypePtr type;
|
||||
bool is_capture = false;
|
||||
bool is_const = false;
|
||||
bool is_enum_const = false;
|
||||
|
@ -172,7 +172,8 @@ protected:
|
|||
AttributesPtr attrs;
|
||||
|
||||
// contains list of functions that are called when an option changes
|
||||
std::multimap<int, FuncPtr> option_handlers;
|
||||
using OptionHandler = std::pair<int, FuncPtr>;
|
||||
std::forward_list<OptionHandler> option_handlers;
|
||||
|
||||
// Information managed by script optimization. We package this
|
||||
// up into a separate object for purposes of modularity, and,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue