mirror of
https://github.com/falcosecurity/falco.git
synced 2025-07-16 15:51:55 +00:00
update(userspace): pass string as const refs when possible
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
This commit is contained in:
parent
b4ea2f4da2
commit
83a83a5853
@ -17,12 +17,11 @@ limitations under the License.
|
||||
#include "filter_evttype_resolver.h"
|
||||
#include <sinsp.h>
|
||||
|
||||
using namespace std;
|
||||
using namespace libsinsp::filter;
|
||||
|
||||
extern sinsp_evttables g_infotables;
|
||||
|
||||
static bool is_evttype_operator(const string& op)
|
||||
static bool is_evttype_operator(const std::string& op)
|
||||
{
|
||||
return op == "==" || op == "=" || op == "!=" || op == "in";
|
||||
}
|
||||
@ -44,7 +43,7 @@ void filter_evttype_resolver::visitor::inversion(falco_event_types& types)
|
||||
}
|
||||
}
|
||||
|
||||
void filter_evttype_resolver::visitor::evttypes(string evtname, falco_event_types& out)
|
||||
void filter_evttype_resolver::visitor::evttypes(const std::string& evtname, falco_event_types& out)
|
||||
{
|
||||
// Fill in from 2 to PPM_EVENT_MAX-1. 0 and 1 are excluded as
|
||||
// those are PPM_GENERIC_E/PPME_GENERIC_X
|
||||
@ -53,7 +52,7 @@ void filter_evttype_resolver::visitor::evttypes(string evtname, falco_event_type
|
||||
{
|
||||
// Skip unused events or events not matching the requested evtname
|
||||
if(!(etable[i].flags & EF_UNUSED)
|
||||
&& (evtname.empty() || string(etable[i].name) == evtname))
|
||||
&& (evtname.empty() || std::string(etable[i].name) == evtname))
|
||||
{
|
||||
out.insert(i);
|
||||
}
|
||||
|
@ -157,7 +157,7 @@ public:
|
||||
string is passed, all the available evttypes are collected
|
||||
\param out The set to be filled with the evttypes
|
||||
*/
|
||||
inline void evttypes(std::string evtname, falco_event_types& out) const
|
||||
inline void evttypes(const std::string& evtname, falco_event_types& out) const
|
||||
{
|
||||
falco_event_types evt_types;
|
||||
visitor().evttypes(evtname, evt_types);
|
||||
@ -205,6 +205,6 @@ private:
|
||||
void visit(libsinsp::filter::ast::unary_check_expr* e) override;
|
||||
void visit(libsinsp::filter::ast::binary_check_expr* e) override;
|
||||
void inversion(falco_event_types& types);
|
||||
void evttypes(std::string evtname, falco_event_types& out);
|
||||
void evttypes(const std::string& evtname, falco_event_types& out);
|
||||
};
|
||||
};
|
||||
|
@ -21,7 +21,7 @@ limitations under the License.
|
||||
|
||||
using namespace falco::app;
|
||||
|
||||
static std::string read_file(std::string &filename)
|
||||
static std::string read_file(const std::string &filename)
|
||||
{
|
||||
std::ifstream t(filename);
|
||||
std::string str((std::istreambuf_iterator<char>(t)),
|
||||
|
Loading…
Reference in New Issue
Block a user