mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
VectorVal: Embed vector_val
Similar motivation as for RecordVal, save an extra malloc/free and pointer indirection. This breaks the `auto& RawVec()` API which previously returned a reference to the std::vector*. It now returns a reference to the vector instead. It's commented as intended for internal and compiled code, so even though it's public API, The previous `std::vector<std::optional<ZVal>>*&` return type was also very likely not intended (all consumers just dereference it anyhow). I'm certain this API was never meant to modify the actual pointer value. I've switched to explicit typing, too.
This commit is contained in:
parent
f362935a66
commit
cbaf43e8ea
7 changed files with 70 additions and 81 deletions
|
@ -314,13 +314,13 @@ void ValTrace::TraceTable(const TableValPtr& tv)
|
|||
void ValTrace::TraceVector(const VectorValPtr& vv)
|
||||
{
|
||||
auto& vec = vv->RawVec();
|
||||
auto n = vec->size();
|
||||
auto n = vec.size();
|
||||
auto& yt = vv->RawYieldType();
|
||||
auto& yts = vv->RawYieldTypes();
|
||||
|
||||
for ( auto i = 0U; i < n; ++i )
|
||||
{
|
||||
auto& elem = (*vec)[i];
|
||||
auto& elem = vec[i];
|
||||
if ( elem )
|
||||
{
|
||||
auto& t = yts ? (*yts)[i] : yt;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue