mirror of
https://github.com/zeek/zeek.git
synced 2025-10-04 23:58:20 +00:00
Integrate review feedback
This commit is contained in:
parent
0f41b063b2
commit
72e15fe4d4
6 changed files with 18 additions and 27 deletions
|
@ -410,7 +410,7 @@ std::pair<bool, Frame*> Frame::Unserialize(const broker::vector& data)
|
|||
return std::make_pair(false, nullptr);
|
||||
}
|
||||
|
||||
rf->frame[i] = val.release();
|
||||
rf->frame[i] = val.detach();
|
||||
}
|
||||
|
||||
return std::make_pair(true, rf);
|
||||
|
|
|
@ -5,15 +5,6 @@
|
|||
#include <type_traits>
|
||||
#include <utility>
|
||||
|
||||
// These forward declarations only exist to enable ADL for the Ref and Unref
|
||||
// functions.
|
||||
|
||||
struct IntrusivePtrDummy;
|
||||
|
||||
void Ref(IntrusivePtrDummy*);
|
||||
|
||||
void Unref(IntrusivePtrDummy*);
|
||||
|
||||
// An intrusive, reference counting smart pointer implementation.
|
||||
template <class T>
|
||||
class IntrusivePtr {
|
||||
|
@ -76,7 +67,7 @@ public:
|
|||
|
||||
// Returns the raw pointer without modifying the reference count and sets
|
||||
// this to `nullptr`.
|
||||
pointer release() noexcept
|
||||
pointer detach() noexcept
|
||||
{
|
||||
auto result = ptr_;
|
||||
if ( result )
|
||||
|
|
|
@ -3159,7 +3159,7 @@ Val* cast_value_to_type(Val* v, BroType* t)
|
|||
if ( ! dv )
|
||||
return 0;
|
||||
|
||||
return static_cast<bro_broker::DataVal *>(dv)->castTo(t).release();
|
||||
return static_cast<bro_broker::DataVal *>(dv)->castTo(t).detach();
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -229,14 +229,14 @@ struct val_converter {
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
list_val->Append(index_val.release());
|
||||
list_val->Append(index_val.detach());
|
||||
}
|
||||
|
||||
|
||||
rval->Assign(list_val.get(), nullptr);
|
||||
}
|
||||
|
||||
return rval.release();
|
||||
return rval.detach();
|
||||
}
|
||||
|
||||
result_type operator()(broker::table& a)
|
||||
|
@ -293,7 +293,7 @@ struct val_converter {
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
list_val->Append(index_val.release());
|
||||
list_val->Append(index_val.detach());
|
||||
}
|
||||
|
||||
auto value_val = bro_broker::data_to_val(move(item.second),
|
||||
|
@ -304,10 +304,10 @@ struct val_converter {
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
rval->Assign(list_val.get(), value_val.release());
|
||||
rval->Assign(list_val.get(), value_val.detach());
|
||||
}
|
||||
|
||||
return rval.release();
|
||||
return rval.detach();
|
||||
}
|
||||
|
||||
result_type operator()(broker::vector& a)
|
||||
|
@ -326,10 +326,10 @@ struct val_converter {
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
rval->Assign(rval->Size(), item_val.release());
|
||||
rval->Assign(rval->Size(), item_val.detach());
|
||||
}
|
||||
|
||||
return rval.release();
|
||||
return rval.detach();
|
||||
}
|
||||
else if ( type->Tag() == TYPE_FUNC )
|
||||
{
|
||||
|
@ -399,11 +399,11 @@ struct val_converter {
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
rval->Assign(i, item_val.release());
|
||||
rval->Assign(i, item_val.detach());
|
||||
++idx;
|
||||
}
|
||||
|
||||
return rval.release();
|
||||
return rval.detach();
|
||||
}
|
||||
else if ( type->Tag() == TYPE_PATTERN )
|
||||
{
|
||||
|
|
|
@ -1033,7 +1033,7 @@ void Manager::ProcessEvent(const broker::topic& topic, broker::zeek::Event ev)
|
|||
auto val = data_to_val(std::move(args[i]), expected_type);
|
||||
|
||||
if ( val )
|
||||
vl.push_back(val.release());
|
||||
vl.push_back(val.detach());
|
||||
else
|
||||
{
|
||||
auto expected_name = type_name(expected_type->Tag());
|
||||
|
@ -1245,7 +1245,7 @@ bool Manager::ProcessIdentifierUpdate(broker::zeek::IdentifierUpdate iu)
|
|||
return false;
|
||||
}
|
||||
|
||||
id->SetVal(val.release());
|
||||
id->SetVal(val.detach());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -512,7 +512,7 @@ bool TopkVal::DoUnserialize(const broker::data& data)
|
|||
|
||||
Element* e = new Element();
|
||||
e->epsilon = *epsilon;
|
||||
e->value = val.release();
|
||||
e->value = val.detach();
|
||||
e->parent = b;
|
||||
|
||||
b->elements.insert(b->elements.end(), e);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue