mirror of
https://github.com/falcosecurity/falco.git
synced 2025-08-31 14:20:04 +00:00
refactor: shared_ptr construction
Signed-off-by: Federico Aponte <federico.aponte@sysdig.com>
This commit is contained in:
@@ -230,8 +230,7 @@ void evttype_index_ruleset::clear()
|
||||
{
|
||||
for (size_t i = 0; i < m_rulesets.size(); i++)
|
||||
{
|
||||
std::shared_ptr<ruleset_filters> r(new ruleset_filters());
|
||||
m_rulesets[i] = r;
|
||||
m_rulesets[i] = std::make_shared<ruleset_filters>();
|
||||
}
|
||||
m_filters.clear();
|
||||
}
|
||||
|
@@ -122,8 +122,8 @@ private:
|
||||
// that matched.
|
||||
bool run(sinsp_evt *evt, falco_rule& match);
|
||||
|
||||
// Evaluate an event against the ruleset and return all the
|
||||
// matching rules.
|
||||
// Evaluate an event against the ruleset and return all the
|
||||
// matching rules.
|
||||
bool run(sinsp_evt *evt, std::vector<falco_rule>& matches);
|
||||
|
||||
libsinsp::events::set<ppm_sc_code> sc_codes();
|
||||
@@ -164,9 +164,7 @@ public:
|
||||
|
||||
inline std::shared_ptr<filter_ruleset> new_ruleset() override
|
||||
{
|
||||
std::shared_ptr<filter_ruleset> ret(
|
||||
new evttype_index_ruleset(m_filter_factory));
|
||||
return ret;
|
||||
return std::make_shared<evttype_index_ruleset>(m_filter_factory);
|
||||
}
|
||||
|
||||
private:
|
||||
|
@@ -450,9 +450,8 @@ std::size_t falco_engine::add_source(const std::string &source,
|
||||
std::shared_ptr<sinsp_evt_formatter_factory> formatter_factory)
|
||||
{
|
||||
// evttype_index_ruleset is the default ruleset implementation
|
||||
std::shared_ptr<filter_ruleset_factory> ruleset_factory(
|
||||
new evttype_index_ruleset_factory(filter_factory));
|
||||
size_t idx = add_source(source, filter_factory, formatter_factory, ruleset_factory);
|
||||
size_t idx = add_source(source, filter_factory, formatter_factory,
|
||||
std::make_shared<evttype_index_ruleset_factory>(filter_factory));
|
||||
|
||||
if(source == falco_common::syscall_source)
|
||||
{
|
||||
|
@@ -66,13 +66,11 @@ void configure_output_format(falco::app::state& s)
|
||||
void add_source_to_engine(falco::app::state& s, const std::string& src)
|
||||
{
|
||||
auto src_info = s.source_infos.at(src);
|
||||
auto& filterchecks = *src_info->filterchecks.get();
|
||||
auto& filterchecks = *src_info->filterchecks;
|
||||
auto* inspector = src_info->inspector.get();
|
||||
|
||||
auto filter_factory = std::shared_ptr<sinsp_filter_factory>(
|
||||
new sinsp_filter_factory(inspector, filterchecks));
|
||||
auto formatter_factory = std::shared_ptr<sinsp_evt_formatter_factory>(
|
||||
new sinsp_evt_formatter_factory(inspector, filterchecks));
|
||||
auto filter_factory = std::make_shared<sinsp_filter_factory>(inspector, filterchecks);
|
||||
auto formatter_factory = std::make_shared<sinsp_evt_formatter_factory>(inspector, filterchecks);
|
||||
|
||||
if(s.config->m_json_output)
|
||||
{
|
||||
|
Reference in New Issue
Block a user