mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
Add some uses of std::move in constructors and simple functions for pass-by-value arguments
This commit is contained in:
parent
1e33467844
commit
ef5b169acd
9 changed files with 15 additions and 14 deletions
|
@ -151,7 +151,7 @@ public:
|
|||
// delete values.
|
||||
class DeltaSetSetEntry : public ValDelta {
|
||||
public:
|
||||
DeltaSetSetEntry(const ValTrace* _vt, ValPtr _index) : ValDelta(_vt), index(_index) {}
|
||||
DeltaSetSetEntry(const ValTrace* _vt, ValPtr _index) : ValDelta(_vt), index(std::move(_index)) {}
|
||||
|
||||
std::string Generate(ValTraceMgr* vtm) const override;
|
||||
bool NeedsLHS() const override { return false; }
|
||||
|
@ -166,7 +166,7 @@ private:
|
|||
class DeltaSetTableEntry : public ValDelta {
|
||||
public:
|
||||
DeltaSetTableEntry(const ValTrace* _vt, ValPtr _index, ValPtr _new_val)
|
||||
: ValDelta(_vt), index(_index), new_val(std::move(_new_val)) {}
|
||||
: ValDelta(_vt), index(std::move(_index)), new_val(std::move(_new_val)) {}
|
||||
|
||||
std::string Generate(ValTraceMgr* vtm) const override;
|
||||
|
||||
|
|
|
@ -3057,7 +3057,7 @@ ListExprPtr expand_op(ListExprPtr op, const TypePtr& t) {
|
|||
TableConstructorExpr::TableConstructorExpr(ListExprPtr constructor_list,
|
||||
std::unique_ptr<std::vector<AttrPtr>> arg_attrs, TypePtr arg_type,
|
||||
AttributesPtr arg_attrs2)
|
||||
: UnaryExpr(EXPR_TABLE_CONSTRUCTOR, expand_op(constructor_list, arg_type)) {
|
||||
: UnaryExpr(EXPR_TABLE_CONSTRUCTOR, expand_op(std::move(constructor_list), arg_type)) {
|
||||
if ( IsError() )
|
||||
return;
|
||||
|
||||
|
|
|
@ -1563,7 +1563,7 @@ public:
|
|||
* @return True if the element was inserted or false if the element was
|
||||
* the wrong type.
|
||||
*/
|
||||
bool Append(ValPtr element) { return Insert(Size(), element); }
|
||||
bool Append(ValPtr element) { return Insert(Size(), std::move(element)); }
|
||||
|
||||
// Removes an element at a specific position.
|
||||
bool Remove(unsigned int index);
|
||||
|
|
|
@ -74,7 +74,7 @@ public:
|
|||
*/
|
||||
Packet(int link_type, pkt_timeval* ts, uint32_t caplen, uint32_t len, const u_char* data, bool copy = false,
|
||||
std::string tag = "") {
|
||||
Init(link_type, ts, caplen, len, data, copy, tag);
|
||||
Init(link_type, ts, caplen, len, data, copy, std::move(tag));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -9,9 +9,8 @@
|
|||
using namespace zeek::packet_analysis;
|
||||
|
||||
Component::Component(const std::string& name, factory_callback arg_factory, Tag::subtype_t arg_subtype)
|
||||
: plugin::Component(plugin::component::PACKET_ANALYZER, name, arg_subtype, packet_mgr->GetTagType()) {
|
||||
factory = arg_factory;
|
||||
}
|
||||
: plugin::Component(plugin::component::PACKET_ANALYZER, name, arg_subtype, packet_mgr->GetTagType()),
|
||||
factory(std::move(arg_factory)) {}
|
||||
|
||||
void Component::Initialize() {
|
||||
InitializeTag();
|
||||
|
|
|
@ -263,7 +263,9 @@ void IPBasedAnalyzer::DumpPortDebug() {
|
|||
|
||||
TableValPtr IPBasedAnalyzer::ignore_checksums_nets_table = nullptr;
|
||||
|
||||
void IPBasedAnalyzer::SetIgnoreChecksumsNets(TableValPtr t) { IPBasedAnalyzer::ignore_checksums_nets_table = t; }
|
||||
void IPBasedAnalyzer::SetIgnoreChecksumsNets(TableValPtr t) {
|
||||
IPBasedAnalyzer::ignore_checksums_nets_table = std::move(t);
|
||||
}
|
||||
|
||||
TableValPtr IPBasedAnalyzer::GetIgnoreChecksumsNets() {
|
||||
if ( ! IPBasedAnalyzer::ignore_checksums_nets_table )
|
||||
|
|
|
@ -185,7 +185,7 @@ namespace detail {
|
|||
|
||||
IPTunnelTimer::IPTunnelTimer(double t, IPTunnelAnalyzer::IPPair p, IPTunnelAnalyzer* analyzer)
|
||||
: Timer(t + BifConst::Tunnel::ip_tunnel_timeout, zeek::detail::TIMER_IP_TUNNEL_INACTIVITY),
|
||||
tunnel_idx(p),
|
||||
tunnel_idx(std::move(p)),
|
||||
analyzer(analyzer) {}
|
||||
|
||||
void IPTunnelTimer::Dispatch(double t, bool is_expire) {
|
||||
|
|
|
@ -71,7 +71,7 @@ public:
|
|||
// but not have an associated expression, if the point-of-definition
|
||||
// is the end of a confluence block.
|
||||
const ExprPtr& DefExprAfter() const { return def_expr; }
|
||||
void SetDefExpr(ExprPtr e) { def_expr = e; }
|
||||
void SetDefExpr(ExprPtr e) { def_expr = std::move(e); }
|
||||
|
||||
// Used for debugging.
|
||||
void Dump() const;
|
||||
|
@ -107,7 +107,7 @@ protected:
|
|||
|
||||
class IDInitInfo {
|
||||
public:
|
||||
IDInitInfo(const ID* _id, ExprPtr _init, InitClass _ic) : id(_id), init(_init), ic(_ic) {}
|
||||
IDInitInfo(const ID* _id, ExprPtr _init, InitClass _ic) : id(_id), init(std::move(_init)), ic(_ic) {}
|
||||
|
||||
const ID* Id() const { return id; }
|
||||
const ExprPtr& Init() const { return init; }
|
||||
|
|
|
@ -172,8 +172,8 @@ protected:
|
|||
class CoalescedScriptFunc : public ScriptFunc {
|
||||
public:
|
||||
CoalescedScriptFunc(StmtPtr merged_body, ScopePtr scope, ScriptFuncPtr orig_func)
|
||||
: ScriptFunc(orig_func->Name(), orig_func->GetType(), {merged_body}, {0}), orig_func(orig_func) {
|
||||
SetScope(scope);
|
||||
: ScriptFunc(orig_func->Name(), orig_func->GetType(), {std::move(merged_body)}, {0}), orig_func(orig_func) {
|
||||
SetScope(std::move(scope));
|
||||
};
|
||||
|
||||
ValPtr Invoke(zeek::Args* args, Frame* parent) const override {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue